summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-08 15:08:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-08 15:08:00 +0000
commit684838d4bea13af1dac9c2f32b99985bf0f9f8e2 (patch)
tree611fcc177ba5a4fe702668c25aa68119675dbd8e /db
parent012f9a4b9ec4a78d9593d882b38f95e376c2cfe2 (diff)
downloadgitlab-ce-684838d4bea13af1dac9c2f32b99985bf0f9f8e2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb9
-rw-r--r--db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb13
-rw-r--r--db/post_migrate/20230303154314_add_user_type_migration_indexes.rb22
-rw-r--r--db/schema_migrations/202303031543141
-rw-r--r--db/schema_migrations/202303061452301
-rw-r--r--db/schema_migrations/202303071228381
-rw-r--r--db/structure.sql6
7 files changed, 53 insertions, 0 deletions
diff --git a/db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb b/db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb
new file mode 100644
index 00000000000..4ae2479b1e6
--- /dev/null
+++ b/db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddProductAnalyticsDataCollectorHostToApplicationSettings < Gitlab::Database::Migration[2.1]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ def change
+ add_column :application_settings, :product_analytics_data_collector_host, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb b/db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb
new file mode 100644
index 00000000000..4f87cc9aee0
--- /dev/null
+++ b/db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToApplicationSettingsProductAnalyticsDataCollectorHost < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :application_settings, :product_analytics_data_collector_host, 255
+ end
+
+ def down
+ remove_text_limit :application_settings, :product_analytics_data_collector_host
+ end
+end
diff --git a/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb b/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb
new file mode 100644
index 00000000000..8f9e193f0eb
--- /dev/null
+++ b/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddUserTypeMigrationIndexes < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ BILLABLE_INDEX = 'index_users_for_active_billable_users_migration'
+ LAST_ACTIVITY_INDEX = 'i_users_on_last_activity_for_active_human_service_migration'
+
+ def up
+ # Temporary indexes to migrate human user_type. See https://gitlab.com/gitlab-org/gitlab/-/issues/386474
+ add_concurrent_index :users, :id, name: BILLABLE_INDEX,
+ where: "state = 'active' AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[6, 4, 13]))) " \
+ "AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[4, 5])))"
+ add_concurrent_index :users, [:id, :last_activity_on], name: LAST_ACTIVITY_INDEX,
+ where: "((state)::text = 'active'::text) AND ((user_type IS NULL OR user_type = 0) OR (user_type = 4))"
+ end
+
+ def down
+ remove_concurrent_index_by_name :users, BILLABLE_INDEX
+ remove_concurrent_index_by_name :users, LAST_ACTIVITY_INDEX
+ end
+end
diff --git a/db/schema_migrations/20230303154314 b/db/schema_migrations/20230303154314
new file mode 100644
index 00000000000..30a33a6efba
--- /dev/null
+++ b/db/schema_migrations/20230303154314
@@ -0,0 +1 @@
+c18a674b6df4baf6d81177df2eb4497dc73979ff71142a9ecda71ec515a588b4 \ No newline at end of file
diff --git a/db/schema_migrations/20230306145230 b/db/schema_migrations/20230306145230
new file mode 100644
index 00000000000..d0fa5e5634b
--- /dev/null
+++ b/db/schema_migrations/20230306145230
@@ -0,0 +1 @@
+ca28b1355e5cc8c1e77c85a4d5e6a40b66767a8588068eb7e1528ba0e575f5da \ No newline at end of file
diff --git a/db/schema_migrations/20230307122838 b/db/schema_migrations/20230307122838
new file mode 100644
index 00000000000..adf5d84a474
--- /dev/null
+++ b/db/schema_migrations/20230307122838
@@ -0,0 +1 @@
+5b147e92d42b7ec317106d905a3af4d1aee983bce8538c26a619ad32ad06c42e \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index ed022ff4d94..9e1094123fe 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -11747,6 +11747,7 @@ CREATE TABLE application_settings (
security_policy_global_group_approvers_enabled boolean DEFAULT true NOT NULL,
projects_api_rate_limit_unauthenticated integer DEFAULT 400 NOT NULL,
deny_all_requests_except_allowed boolean DEFAULT false NOT NULL,
+ product_analytics_data_collector_host text,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)),
CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
@@ -11777,6 +11778,7 @@ CREATE TABLE application_settings (
CONSTRAINT check_5bcba483c4 CHECK ((char_length(sentry_environment) <= 255)),
CONSTRAINT check_718b4458ae CHECK ((char_length(personal_access_token_prefix) <= 20)),
CONSTRAINT check_7227fad848 CHECK ((char_length(rate_limiting_response_text) <= 255)),
+ CONSTRAINT check_72c984b2a5 CHECK ((char_length(product_analytics_data_collector_host) <= 255)),
CONSTRAINT check_734cc9407a CHECK ((char_length(globally_allowed_ips) <= 255)),
CONSTRAINT check_7ccfe2764a CHECK ((char_length(arkose_labs_namespace) <= 255)),
CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)),
@@ -28910,6 +28912,8 @@ CREATE UNIQUE INDEX i_pm_package_versions_on_package_id_and_version ON pm_packag
CREATE UNIQUE INDEX i_pm_packages_purl_type_and_name ON pm_packages USING btree (purl_type, name);
+CREATE INDEX i_users_on_last_activity_for_active_human_service_migration ON users USING btree (id, last_activity_on) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = 0) OR (user_type = 4)));
+
CREATE INDEX idx_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id);
CREATE INDEX idx_analytics_devops_adoption_snapshots_finalized ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time) WHERE (recorded_at >= end_time);
@@ -32152,6 +32156,8 @@ CREATE UNIQUE INDEX index_user_synced_attributes_metadata_on_user_id ON user_syn
CREATE INDEX index_users_for_active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[6, 4, 13]))) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[4, 5]))));
+CREATE INDEX index_users_for_active_billable_users_migration ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = 0) OR (user_type = ANY (ARRAY[6, 4, 13]))) AND ((user_type IS NULL) OR (user_type = 0) OR (user_type = ANY (ARRAY[4, 5]))));
+
CREATE INDEX index_users_on_accepted_term_id ON users USING btree (accepted_term_id);
CREATE INDEX index_users_on_admin ON users USING btree (admin);