Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-19 18:19:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-19 18:19:34 +0300
commitb6d63c915a91aeb7a4437349c53e68be8c50cf4e (patch)
tree8617959c1d6b9137e4cefad06aedbf574295cd6c /db
parent2017bc90a671eac669f0114b6ef508e151409c4f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/docs/batched_background_migrations/update_code_suggestions_for_namespace_settings.yml6
-rw-r--r--db/migrate/20230406095544_add_pa_configurator_base_to_app_settings.rb13
-rw-r--r--db/migrate/20230410092450_add_product_analytics_instrumentation_key_to_project_settings.rb21
-rw-r--r--db/migrate/20230413153140_add_text_limit_to_project_settings_instrumentation_key.rb13
-rw-r--r--db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb34
-rw-r--r--db/post_migrate/20230405132855_remove_scim_token_and_scim_identity_non_root_group.rb34
-rw-r--r--db/post_migrate/20230418164957_queue_update_code_suggestions_for_namespace_settings.rb25
-rw-r--r--db/schema_migrations/202304051321041
-rw-r--r--db/schema_migrations/202304051328551
-rw-r--r--db/schema_migrations/202304060955441
-rw-r--r--db/schema_migrations/202304100924501
-rw-r--r--db/schema_migrations/202304131531401
-rw-r--r--db/schema_migrations/202304181649571
-rw-r--r--db/structure.sql4
14 files changed, 156 insertions, 0 deletions
diff --git a/db/docs/batched_background_migrations/update_code_suggestions_for_namespace_settings.yml b/db/docs/batched_background_migrations/update_code_suggestions_for_namespace_settings.yml
new file mode 100644
index 00000000000..e0196878d61
--- /dev/null
+++ b/db/docs/batched_background_migrations/update_code_suggestions_for_namespace_settings.yml
@@ -0,0 +1,6 @@
+---
+migration_job_name: UpdateCodeSuggestionsForNamespaceSettings
+description: Enables Code Suggestions for all namespaces by default
+feature_category: code_suggestions
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117899
+milestone: 16.0
diff --git a/db/migrate/20230406095544_add_pa_configurator_base_to_app_settings.rb b/db/migrate/20230406095544_add_pa_configurator_base_to_app_settings.rb
new file mode 100644
index 00000000000..b6b33cdf17b
--- /dev/null
+++ b/db/migrate/20230406095544_add_pa_configurator_base_to_app_settings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddPaConfiguratorBaseToAppSettings < Gitlab::Database::Migration[2.1]
+ def up
+ add_column :application_settings, :encrypted_product_analytics_configurator_connection_string, :binary
+ add_column :application_settings, :encrypted_product_analytics_configurator_connection_string_iv, :binary
+ end
+
+ def down
+ remove_column :application_settings, :encrypted_product_analytics_configurator_connection_string
+ remove_column :application_settings, :encrypted_product_analytics_configurator_connection_string_iv
+ end
+end
diff --git a/db/migrate/20230410092450_add_product_analytics_instrumentation_key_to_project_settings.rb b/db/migrate/20230410092450_add_product_analytics_instrumentation_key_to_project_settings.rb
new file mode 100644
index 00000000000..eaaddef083c
--- /dev/null
+++ b/db/migrate/20230410092450_add_product_analytics_instrumentation_key_to_project_settings.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddProductAnalyticsInstrumentationKeyToProjectSettings < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20230413153140_add_text_limit_to_project_settings_instrumentation_key.rb
+ def up
+ with_lock_retries do
+ add_column :project_settings, :product_analytics_instrumentation_key, :text unless
+ column_exists?(:project_settings, :product_analytics_instrumentation_key)
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :project_settings, :product_analytics_instrumentation_key
+ end
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20230413153140_add_text_limit_to_project_settings_instrumentation_key.rb b/db/migrate/20230413153140_add_text_limit_to_project_settings_instrumentation_key.rb
new file mode 100644
index 00000000000..7ec0a800066
--- /dev/null
+++ b/db/migrate/20230413153140_add_text_limit_to_project_settings_instrumentation_key.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToProjectSettingsInstrumentationKey < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :project_settings, :product_analytics_instrumentation_key, 255
+ end
+
+ def down
+ remove_text_limit :project_settings, :product_analytics_instrumentation_key
+ end
+end
diff --git a/db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb b/db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb
new file mode 100644
index 00000000000..55a017464c2
--- /dev/null
+++ b/db/post_migrate/20230405132104_remove_saml_provider_and_identities_non_root_group.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+class RemoveSamlProviderAndIdentitiesNonRootGroup < Gitlab::Database::Migration[2.1]
+ BATCH_SIZE = 500
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ each_batch_range('saml_providers', scope: ->(table) { table.all }, of: BATCH_SIZE) do |min, max|
+ execute <<~SQL
+ DELETE FROM identities
+ WHERE identities.saml_provider_id
+ IN
+ (
+ SELECT saml_providers.id FROM saml_providers
+ INNER JOIN namespaces ON namespaces.id=saml_providers.group_id
+ AND namespaces.type='Group' AND namespaces.parent_id IS NOT NULL
+ AND saml_providers.id BETWEEN #{min} AND #{max}
+ );
+
+ DELETE FROM saml_providers
+ USING namespaces
+ WHERE namespaces.id=saml_providers.group_id
+ AND namespaces.type='Group' AND namespaces.parent_id IS NOT NULL
+ AND saml_providers.id BETWEEN #{min} AND #{max};
+ SQL
+ end
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/post_migrate/20230405132855_remove_scim_token_and_scim_identity_non_root_group.rb b/db/post_migrate/20230405132855_remove_scim_token_and_scim_identity_non_root_group.rb
new file mode 100644
index 00000000000..aa149acc5be
--- /dev/null
+++ b/db/post_migrate/20230405132855_remove_scim_token_and_scim_identity_non_root_group.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+class RemoveScimTokenAndScimIdentityNonRootGroup < Gitlab::Database::Migration[2.1]
+ BATCH_SIZE = 500
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ each_batch_range('scim_oauth_access_tokens', scope: ->(table) { table.all }, of: BATCH_SIZE) do |min, max|
+ execute <<~SQL
+ DELETE FROM scim_identities
+ WHERE scim_identities.group_id
+ IN
+ (
+ SELECT namespaces.id FROM scim_oauth_access_tokens
+ INNER JOIN namespaces ON namespaces.id=scim_oauth_access_tokens.group_id
+ WHERE namespaces.type='Group' AND namespaces.parent_id IS NOT NULL
+ AND scim_oauth_access_tokens.id BETWEEN #{min} AND #{max}
+ );
+
+ DELETE FROM scim_oauth_access_tokens
+ USING namespaces
+ WHERE namespaces.id=scim_oauth_access_tokens.group_id
+ AND namespaces.type='Group' AND namespaces.parent_id IS NOT NULL
+ AND scim_oauth_access_tokens.id BETWEEN #{min} AND #{max};
+ SQL
+ end
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/post_migrate/20230418164957_queue_update_code_suggestions_for_namespace_settings.rb b/db/post_migrate/20230418164957_queue_update_code_suggestions_for_namespace_settings.rb
new file mode 100644
index 00000000000..faf5a4978ab
--- /dev/null
+++ b/db/post_migrate/20230418164957_queue_update_code_suggestions_for_namespace_settings.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class QueueUpdateCodeSuggestionsForNamespaceSettings < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'UpdateCodeSuggestionsForNamespaceSettings'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 1_000
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :namespace_settings,
+ :namespace_id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :namespace_settings, :namespace_id, [])
+ end
+end
diff --git a/db/schema_migrations/20230405132104 b/db/schema_migrations/20230405132104
new file mode 100644
index 00000000000..e8d9bd7ded7
--- /dev/null
+++ b/db/schema_migrations/20230405132104
@@ -0,0 +1 @@
+eae464c7583b909d975c379d196b7ae5301580f7195907a476ca1a146d8cb6b1 \ No newline at end of file
diff --git a/db/schema_migrations/20230405132855 b/db/schema_migrations/20230405132855
new file mode 100644
index 00000000000..209578a8ed4
--- /dev/null
+++ b/db/schema_migrations/20230405132855
@@ -0,0 +1 @@
+a7928284883d79b1204bb39a2a2d34b173771ce6dc484cefdb1c7ec3e9e9477a \ No newline at end of file
diff --git a/db/schema_migrations/20230406095544 b/db/schema_migrations/20230406095544
new file mode 100644
index 00000000000..56e891d65db
--- /dev/null
+++ b/db/schema_migrations/20230406095544
@@ -0,0 +1 @@
+3774f65f475364f3748502b035bdb3d18db0588a0f3ed45ca19cc5492ce754df \ No newline at end of file
diff --git a/db/schema_migrations/20230410092450 b/db/schema_migrations/20230410092450
new file mode 100644
index 00000000000..1b7b88026f5
--- /dev/null
+++ b/db/schema_migrations/20230410092450
@@ -0,0 +1 @@
+3a2c45579f8f566a2224afcab84b9f403e49379603e164f141a4dc89b5f4b512 \ No newline at end of file
diff --git a/db/schema_migrations/20230413153140 b/db/schema_migrations/20230413153140
new file mode 100644
index 00000000000..97af4a6962f
--- /dev/null
+++ b/db/schema_migrations/20230413153140
@@ -0,0 +1 @@
+e78e74c9c068235ede55859b56bea671d9da5c3e74ac315e1b9391b6eef2649b \ No newline at end of file
diff --git a/db/schema_migrations/20230418164957 b/db/schema_migrations/20230418164957
new file mode 100644
index 00000000000..e7fa549aba4
--- /dev/null
+++ b/db/schema_migrations/20230418164957
@@ -0,0 +1 @@
+80eb5db3db246ff6b2b857252cee05049cc0f7c09d0487175cfa90eeaf93f20c \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index b08065a5cd4..87c6aff9937 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -11800,6 +11800,8 @@ CREATE TABLE application_settings (
encrypted_openai_api_key bytea,
encrypted_openai_api_key_iv bytea,
database_max_running_batched_background_migrations integer DEFAULT 2 NOT NULL,
+ encrypted_product_analytics_configurator_connection_string bytea,
+ encrypted_product_analytics_configurator_connection_string_iv bytea,
silent_mode_enabled boolean DEFAULT false NOT NULL,
package_metadata_purl_types smallint[] DEFAULT '{}'::smallint[],
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
@@ -21107,11 +21109,13 @@ CREATE TABLE project_settings (
pages_unique_domain_enabled boolean DEFAULT false NOT NULL,
pages_unique_domain text,
runner_registration_enabled boolean DEFAULT true,
+ product_analytics_instrumentation_key text,
CONSTRAINT check_1a30456322 CHECK ((char_length(pages_unique_domain) <= 63)),
CONSTRAINT check_2981f15877 CHECK ((char_length(jitsu_key) <= 100)),
CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)),
CONSTRAINT check_3ca5cbffe6 CHECK ((char_length(issue_branch_template) <= 255)),
CONSTRAINT check_67292e4b99 CHECK ((char_length(mirror_branch_regex) <= 255)),
+ CONSTRAINT check_acb7fad2f9 CHECK ((char_length(product_analytics_instrumentation_key) <= 255)),
CONSTRAINT check_b09644994b CHECK ((char_length(squash_commit_template) <= 500)),
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)),
CONSTRAINT check_eaf7cfb6a7 CHECK ((char_length(merge_commit_template) <= 500))