diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-08 15:08:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-08 15:08:54 +0300 |
commit | 473b876fe3d7e0b36eb6268cc44a4fe0d94f4422 (patch) | |
tree | 2f6d5f2ecad53015024b6b1509896f5933c5c3e6 /db | |
parent | dca8df0c90d8727d69b3501b15b481546897f3cd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
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); |