diff --git a/db/post_migrate/20250127184534_schedule_index_ci_pipelines_on_project_id_and_sha_and_id.rb b/db/post_migrate/20250127184534_schedule_index_ci_pipelines_on_project_id_and_sha_and_id.rb new file mode 100644 index 0000000000000000000000000000000000000000..5270392f18094ee654024238c8d1b07e1fc046ac --- /dev/null +++ b/db/post_migrate/20250127184534_schedule_index_ci_pipelines_on_project_id_and_sha_and_id.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ScheduleIndexCiPipelinesOnProjectIdAndShaAndId < Gitlab::Database::Migration[2.2] + milestone '17.9' + disable_ddl_transaction! + + TABLE_NAME = :ci_pipelines + COLUMN_NAMES = [:project_id, :sha, :id] + INDEX_NAME = 'ci_pipelines_on_project_id_and_sha_and_id' + + # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/516073 + def up + prepare_async_index(TABLE_NAME, COLUMN_NAMES, name: INDEX_NAME) + end + + def down + unprepare_async_index(TABLE_NAME, COLUMN_NAMES, name: INDEX_NAME) + end +end diff --git a/db/schema_migrations/20250127184534 b/db/schema_migrations/20250127184534 new file mode 100644 index 0000000000000000000000000000000000000000..95a0afaca717f21e34b2cd7fc0ef93d4fd47ff2a --- /dev/null +++ b/db/schema_migrations/20250127184534 @@ -0,0 +1 @@ +ab8ee7d18e100a78130cad7d073316497d623ff6005ee38a3bdc549664b9e7b4 \ No newline at end of file