diff options
Diffstat (limited to 'db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb')
-rw-r--r-- | db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb b/db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb new file mode 100644 index 00000000000..ac4821b8007 --- /dev/null +++ b/db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemoveTemporaryIndexForProjectTopicsOnTaggings < Gitlab::Database::Migration[1.0] + MIGRATION = 'ExtractProjectTopicsIntoSeparateTable' + INDEX_NAME = 'tmp_index_taggings_on_id_where_taggable_type_project' + INDEX_CONDITION = "taggable_type = 'Project'" + + disable_ddl_transaction! + + def up + # Ensure that no background jobs of 20210730104800_schedule_extract_project_topics_into_separate_table remain + finalize_background_migration MIGRATION + # this index was used in 20210730104800_schedule_extract_project_topics_into_separate_table + remove_concurrent_index_by_name :taggings, INDEX_NAME + end + + def down + add_concurrent_index :taggings, :id, where: INDEX_CONDITION, name: INDEX_NAME # rubocop:disable Migration/PreventIndexCreation + end +end |