summaryrefslogtreecommitdiff
path: root/db/post_migrate/20211028100303_tmp_index_for_delete_issue_merge_request_taggings_records.rb
blob: 98984239ca4faeacc4c6cf31e85fcfe216b42894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class TmpIndexForDeleteIssueMergeRequestTaggingsRecords < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  INDEX_NAME = 'tmp_index_taggings_on_id_where_taggable_type_issue_mr'
  INDEX_CONDITION = "taggable_type IN ('Issue', 'MergeRequest')"

  def up
    add_concurrent_index :taggings, :id, where: INDEX_CONDITION, name: INDEX_NAME # rubocop:disable Migration/PreventIndexCreation
  end

  def down
    remove_concurrent_index_by_name :taggings, INDEX_NAME
  end
end