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:
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20230517005523_ensure_backfill_bigint_id_is_completed.rb23
-rw-r--r--db/post_migrate/20230518005523_add_concurrent_index_for_ci_pipeline_variables_bigint_id.rb18
-rw-r--r--db/schema_migrations/202305170055231
-rw-r--r--db/schema_migrations/202305180055231
-rw-r--r--db/structure.sql2
5 files changed, 45 insertions, 0 deletions
diff --git a/db/post_migrate/20230517005523_ensure_backfill_bigint_id_is_completed.rb b/db/post_migrate/20230517005523_ensure_backfill_bigint_id_is_completed.rb
new file mode 100644
index 00000000000..850ac7bcf5d
--- /dev/null
+++ b/db/post_migrate/20230517005523_ensure_backfill_bigint_id_is_completed.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class EnsureBackfillBigintIdIsCompleted < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_ci
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_pipeline_variables
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [['id'], ['id_convert_to_bigint']]
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230518005523_add_concurrent_index_for_ci_pipeline_variables_bigint_id.rb b/db/post_migrate/20230518005523_add_concurrent_index_for_ci_pipeline_variables_bigint_id.rb
new file mode 100644
index 00000000000..19c48f7bf11
--- /dev/null
+++ b/db/post_migrate/20230518005523_add_concurrent_index_for_ci_pipeline_variables_bigint_id.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddConcurrentIndexForCiPipelineVariablesBigintId < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_pipeline_variables
+ INDEX_NAME = "index_#{TABLE_NAME}_on_id_convert_to_bigint"
+
+ def up
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20230517005523 b/db/schema_migrations/20230517005523
new file mode 100644
index 00000000000..7fdac2b9961
--- /dev/null
+++ b/db/schema_migrations/20230517005523
@@ -0,0 +1 @@
+4d84a87532b45436e64d0c919b361548b4b69b200ec3a91f454af718a51fd22a \ No newline at end of file
diff --git a/db/schema_migrations/20230518005523 b/db/schema_migrations/20230518005523
new file mode 100644
index 00000000000..700da3dff74
--- /dev/null
+++ b/db/schema_migrations/20230518005523
@@ -0,0 +1 @@
+7428675eac2c572aa3521df7af7e79f7cf1b6e8f8472e99c842dddf2f3c7ce77 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index d106f3f7064..8fe5a4c0011 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -30525,6 +30525,8 @@ CREATE INDEX index_ci_pipeline_schedules_on_owner_id_and_id_and_active ON ci_pip
CREATE INDEX index_ci_pipeline_schedules_on_project_id ON ci_pipeline_schedules USING btree (project_id);
+CREATE UNIQUE INDEX index_ci_pipeline_variables_on_id_convert_to_bigint ON ci_pipeline_variables USING btree (id_convert_to_bigint);
+
CREATE UNIQUE INDEX index_ci_pipeline_variables_on_pipeline_id_and_key ON ci_pipeline_variables USING btree (pipeline_id, key);
CREATE INDEX index_ci_pipelines_config_on_pipeline_id ON ci_pipelines_config USING btree (pipeline_id);