diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-23 12:08:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-23 12:08:09 +0300 |
commit | 5831f05b4ce3e5af23c98a8c9495419509df6d62 (patch) | |
tree | 9b797e9fe9f0d32972b92072962e0838135a117f /db | |
parent | 784a3db6274bf16a64d2cd947d42182c85cf605f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/docs/service_access_tokens.yml | 2 | ||||
-rw-r--r-- | db/migrate/20240106000000_migrate_data_from_workspaces_url_column.rb | 59 | ||||
-rw-r--r-- | db/migrate/20240116161955_add_name_and_description_to_web_hooks.rb | 13 | ||||
-rw-r--r-- | db/migrate/20240116162201_add_text_limit_to_web_hooks_attributes.rb | 17 | ||||
-rw-r--r-- | db/schema_migrations/20240106000000 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20240116161955 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20240116162201 | 1 | ||||
-rw-r--r-- | db/structure.sql | 6 |
8 files changed, 98 insertions, 2 deletions
diff --git a/db/docs/service_access_tokens.yml b/db/docs/service_access_tokens.yml index c75b62883b0..8a0958707b0 100644 --- a/db/docs/service_access_tokens.yml +++ b/db/docs/service_access_tokens.yml @@ -1,7 +1,7 @@ --- table_name: service_access_tokens classes: -- Ai::ServiceAccessToken +- CloudConnector::ServiceAccessToken feature_categories: - cloud_connector description: Persists JWT tokens for AI features (e.g. Code Suggestions) to authenticate diff --git a/db/migrate/20240106000000_migrate_data_from_workspaces_url_column.rb b/db/migrate/20240106000000_migrate_data_from_workspaces_url_column.rb new file mode 100644 index 00000000000..e5f5ffc376e --- /dev/null +++ b/db/migrate/20240106000000_migrate_data_from_workspaces_url_column.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +class MigrateDataFromWorkspacesUrlColumn < Gitlab::Database::Migration[2.2] + BATCH_SIZE = 500 + DEFAULT_PORT = 60001 + + milestone '16.8' + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + each_batch_range('workspaces', scope: ->(table) { table.all }, of: BATCH_SIZE) do |min, max| + execute(<<~SQL) + UPDATE workspaces + SET url_prefix = CONCAT('https://#{DEFAULT_PORT}-', name), + dns_zone = remote_development_agent_configs.dns_zone, + url_query_string = CASE + WHEN POSITION('?' IN url) > 0 + THEN SUBSTRING(url FROM POSITION('?' IN url) + 1) + ELSE '' + END + FROM + remote_development_agent_configs + WHERE + workspaces.cluster_agent_id = remote_development_agent_configs.cluster_agent_id + AND url IS NOT NULL + AND workspaces.id BETWEEN #{min} AND #{max} + SQL + + execute(<<~SQL) + UPDATE workspaces + SET url = NULL + WHERE workspaces.id BETWEEN #{min} AND #{max} + AND url_prefix IS NOT NULL + AND dns_zone IS NOT NULL + AND url_query_string IS NOT NULL + SQL + end + end + + def down + each_batch_range('workspaces', scope: ->(table) { table.all }, of: BATCH_SIZE) do |min, max| + execute(<<~SQL) + UPDATE workspaces + SET url = CONCAT(url_prefix, '.', dns_zone, '?', url_query_string) + WHERE workspaces.id BETWEEN #{min} AND #{max} + SQL + + execute(<<~SQL) + UPDATE workspaces + SET url_prefix = NULL, + dns_zone = NULL, + url_query_string = NULL + WHERE workspaces.id BETWEEN #{min} AND #{max} + SQL + end + end +end diff --git a/db/migrate/20240116161955_add_name_and_description_to_web_hooks.rb b/db/migrate/20240116161955_add_name_and_description_to_web_hooks.rb new file mode 100644 index 00000000000..b1360fa4aa2 --- /dev/null +++ b/db/migrate/20240116161955_add_name_and_description_to_web_hooks.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddNameAndDescriptionToWebHooks < Gitlab::Database::Migration[2.2] + milestone '16.9' + + # rubocop:disable Migration/AddLimitToTextColumns -- limit is added in + # db/migrate/20240116162201_add_text_limit_to_web_hooks_attributes.rb + def change + add_column :web_hooks, :name, :text + add_column :web_hooks, :description, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20240116162201_add_text_limit_to_web_hooks_attributes.rb b/db/migrate/20240116162201_add_text_limit_to_web_hooks_attributes.rb new file mode 100644 index 00000000000..3802f1c31f5 --- /dev/null +++ b/db/migrate/20240116162201_add_text_limit_to_web_hooks_attributes.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToWebHooksAttributes < Gitlab::Database::Migration[2.2] + milestone '16.9' + + disable_ddl_transaction! + + def up + add_text_limit :web_hooks, :name, 255 + add_text_limit :web_hooks, :description, 2048 + end + + def down + remove_text_limit :web_hooks, :name + remove_text_limit :web_hooks, :description + end +end diff --git a/db/schema_migrations/20240106000000 b/db/schema_migrations/20240106000000 new file mode 100644 index 00000000000..73baf388353 --- /dev/null +++ b/db/schema_migrations/20240106000000 @@ -0,0 +1 @@ +85e9e3512a609e4c9420922dd53ca989fb0f8f70b019d9116871c5877835010c
\ No newline at end of file diff --git a/db/schema_migrations/20240116161955 b/db/schema_migrations/20240116161955 new file mode 100644 index 00000000000..2158e158e8d --- /dev/null +++ b/db/schema_migrations/20240116161955 @@ -0,0 +1 @@ +81b09b45a5c6b7c04cbb9fbd112a3f88f64aa837d0229c66c068d0c66efc8c83
\ No newline at end of file diff --git a/db/schema_migrations/20240116162201 b/db/schema_migrations/20240116162201 new file mode 100644 index 00000000000..51b1472d01a --- /dev/null +++ b/db/schema_migrations/20240116162201 @@ -0,0 +1 @@ +82f6fe5eef8a794bbbd27919800339c03e416f85598f098eb6eb1c54252e62a3
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 763cf0dc349..803b0482055 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -25831,7 +25831,11 @@ CREATE TABLE web_hooks ( encrypted_url_variables_iv bytea, integration_id integer, branch_filter_strategy smallint DEFAULT 0 NOT NULL, - emoji_events boolean DEFAULT false NOT NULL + emoji_events boolean DEFAULT false NOT NULL, + name text, + description text, + CONSTRAINT check_1e4d5cbdc5 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_23a96ad211 CHECK ((char_length(description) <= 2048)) ); CREATE SEQUENCE web_hooks_id_seq |