diff --git a/db/post_migrate/20230117094111_prepare_tmp_index_to_ci_build_trace_metadata.rb b/db/post_migrate/20230117094111_prepare_tmp_index_to_ci_build_trace_metadata.rb new file mode 100644 index 0000000000000000000000000000000000000000..93356b4eb3fb31ae0e132e3b20bf795952687261 --- /dev/null +++ b/db/post_migrate/20230117094111_prepare_tmp_index_to_ci_build_trace_metadata.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class PrepareTmpIndexToCiBuildTraceMetadata < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_build_trace_metadata_on_partition_id_and_id + TABLE_NAME = :ci_build_trace_metadata + + def up + return unless Gitlab.com? + + prepare_async_index(TABLE_NAME, [:partition_id, :build_id], where: 'partition_id = 101', name: INDEX_NAME) + end + + def down + return unless Gitlab.com? + + unprepare_async_index_by_name(TABLE_NAME, INDEX_NAME) + end +end diff --git a/db/post_migrate/20230117094226_prepare_tmp_index_to_ci_job_artifact.rb b/db/post_migrate/20230117094226_prepare_tmp_index_to_ci_job_artifact.rb new file mode 100644 index 0000000000000000000000000000000000000000..db0c51e4cfd8044a30528ea33ee1f4eb6f653f93 --- /dev/null +++ b/db/post_migrate/20230117094226_prepare_tmp_index_to_ci_job_artifact.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class PrepareTmpIndexToCiJobArtifact < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_job_artifacts_on_partition_id_and_id + TABLE_NAME = :ci_job_artifacts + + def up + return unless Gitlab.com? + + prepare_async_index(TABLE_NAME, [:partition_id, :id], where: 'partition_id = 101', name: INDEX_NAME) + end + + def down + return unless Gitlab.com? + + unprepare_async_index_by_name(TABLE_NAME, INDEX_NAME) + end +end diff --git a/db/post_migrate/20230117094316_add_tmp_index_to_ci_job_variable.rb b/db/post_migrate/20230117094316_add_tmp_index_to_ci_job_variable.rb new file mode 100644 index 0000000000000000000000000000000000000000..96de0c9fed180835d8f7f6a4c1c202ff458e5550 --- /dev/null +++ b/db/post_migrate/20230117094316_add_tmp_index_to_ci_job_variable.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddTmpIndexToCiJobVariable < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_job_variables_on_partition_id_and_id + TABLE_NAME = :ci_job_variables + + def up + return unless Gitlab.com? + + add_concurrent_index(TABLE_NAME, [:partition_id, :id], where: 'partition_id = 101', name: INDEX_NAME) + end + + def down + return unless Gitlab.com? + + remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME) + end +end diff --git a/db/schema_migrations/20230117094111 b/db/schema_migrations/20230117094111 new file mode 100644 index 0000000000000000000000000000000000000000..407024de0cb32fae3a2c812bf1e3eaa27c8dc0d8 --- /dev/null +++ b/db/schema_migrations/20230117094111 @@ -0,0 +1 @@ +49b81bf05f155f17d44fede8a513ee5bea56e2ba7cd41a55505e31ba36c50b5e \ No newline at end of file diff --git a/db/schema_migrations/20230117094226 b/db/schema_migrations/20230117094226 new file mode 100644 index 0000000000000000000000000000000000000000..cc0943e7e6563e0037f8a352670ba24d1de7dc58 --- /dev/null +++ b/db/schema_migrations/20230117094226 @@ -0,0 +1 @@ +429754e80bcfde582c92a69a6b655a13254b7ac0fe3504bfad0924560a4c1eed \ No newline at end of file diff --git a/db/schema_migrations/20230117094316 b/db/schema_migrations/20230117094316 new file mode 100644 index 0000000000000000000000000000000000000000..5657905baf9fe73555bd3562f3ab68cddf2e0b4b --- /dev/null +++ b/db/schema_migrations/20230117094316 @@ -0,0 +1 @@ +7cd9ca122b41eb610e03dd258d74c5c7aaa31482a4ff21dfba720def099a1487 \ No newline at end of file