Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ac4821b8007393600a98bf00a0f7e91cee85bd00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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