diff --git a/db/post_migrate/20230112144946_add_tmp_index_to_ci_build_need.rb b/db/post_migrate/20230112144946_add_tmp_index_to_ci_build_need.rb new file mode 100644 index 0000000000000000000000000000000000000000..d1e0ae6665f08a137650c8c9e7eb89991eb63a66 --- /dev/null +++ b/db/post_migrate/20230112144946_add_tmp_index_to_ci_build_need.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddTmpIndexToCiBuildNeed < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_build_needs_on_partition_id_and_id + TABLE_NAME = :ci_build_needs + + 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/20230112145326_add_tmp_index_to_ci_pipeline_variable.rb b/db/post_migrate/20230112145326_add_tmp_index_to_ci_pipeline_variable.rb new file mode 100644 index 0000000000000000000000000000000000000000..920b70765cc941ca090b918502bc3ef324289b47 --- /dev/null +++ b/db/post_migrate/20230112145326_add_tmp_index_to_ci_pipeline_variable.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddTmpIndexToCiPipelineVariable < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_pipeline_variables_on_partition_id_and_id + TABLE_NAME = :ci_pipeline_variables + + 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/20230117092947_add_tmp_index_to_ci_build_report_results.rb b/db/post_migrate/20230117092947_add_tmp_index_to_ci_build_report_results.rb new file mode 100644 index 0000000000000000000000000000000000000000..a116562e9ec315f337f30d1a07962687ce813df9 --- /dev/null +++ b/db/post_migrate/20230117092947_add_tmp_index_to_ci_build_report_results.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddTmpIndexToCiBuildReportResults < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_build_report_results_on_partition_id_and_id + TABLE_NAME = :ci_build_report_results + + 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/schema_migrations/20230112144946 b/db/schema_migrations/20230112144946 new file mode 100644 index 0000000000000000000000000000000000000000..e9e307791f5f94c13452cb0e1c86eeabc448e6fe --- /dev/null +++ b/db/schema_migrations/20230112144946 @@ -0,0 +1 @@ +a2cb76b2138b3edc014c01c4b130fcd58bf81a10c68c897376f5bf8d69d5a660 \ No newline at end of file diff --git a/db/schema_migrations/20230112145326 b/db/schema_migrations/20230112145326 new file mode 100644 index 0000000000000000000000000000000000000000..1878bebba663a70e05f94cf6575f427ae2480aea --- /dev/null +++ b/db/schema_migrations/20230112145326 @@ -0,0 +1 @@ +97a52b54895ff5f5ea3c2dac6148c8d8110081bffe9064c50547b776ec56e78a \ No newline at end of file diff --git a/db/schema_migrations/20230117092947 b/db/schema_migrations/20230117092947 new file mode 100644 index 0000000000000000000000000000000000000000..4eeca7e352629fabff7c62fa1adac7a9e55b2181 --- /dev/null +++ b/db/schema_migrations/20230117092947 @@ -0,0 +1 @@ +775eb98fc81524f667cfab4dfdcee9bd668143c7286011dd1f0d40f87fc06ab0 \ No newline at end of file