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
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb')
-rw-r--r--db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb b/db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb
new file mode 100644
index 00000000000..73334be4214
--- /dev/null
+++ b/db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class ScheduleTemporaryPartitioningIndexesRemoval < Gitlab::Database::Migration[2.1]
+ INDEXES = [
+ [:ci_pipelines, :tmp_index_ci_pipelines_on_partition_id_and_id],
+ [:ci_stages, :tmp_index_ci_stages_on_partition_id_and_id],
+ [:ci_builds, :tmp_index_ci_builds_on_partition_id_and_id],
+ [:ci_build_needs, :tmp_index_ci_build_needs_on_partition_id_and_id],
+ [:ci_build_report_results, :tmp_index_ci_build_report_results_on_partition_id_and_build_id],
+ [:ci_build_trace_metadata, :tmp_index_ci_build_trace_metadata_on_partition_id_and_id],
+ [:ci_job_artifacts, :tmp_index_ci_job_artifacts_on_partition_id_and_id],
+ [:ci_pipeline_variables, :tmp_index_ci_pipeline_variables_on_partition_id_and_id],
+ [:ci_job_variables, :tmp_index_ci_job_variables_on_partition_id_and_id],
+ [:ci_sources_pipelines, :tmp_index_ci_sources_pipelines_on_partition_id_and_id],
+ [:ci_sources_pipelines, :tmp_index_ci_sources_pipelines_on_source_partition_id_and_id],
+ [:ci_running_builds, :tmp_index_ci_running_builds_on_partition_id_and_id],
+ [:ci_pending_builds, :tmp_index_ci_pending_builds_on_partition_id_and_id],
+ [:ci_builds_runner_session, :tmp_index_ci_builds_runner_session_on_partition_id_and_id]
+ ]
+
+ def up
+ INDEXES.each do |table_name, index_name|
+ prepare_async_index_removal table_name, nil, name: index_name
+ end
+ end
+
+ def down
+ INDEXES.each do |table_name, index_name|
+ unprepare_async_index table_name, nil, name: index_name
+ end
+ end
+end