summaryrefslogtreecommitdiff
path: root/db/migrate/20210216223335_remove_index_on_issues_where_service_desk_reply_to_is_not_null.rb
blob: 5224b6f7031825f1a81f1fb55041f1208126dcd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class RemoveIndexOnIssuesWhereServiceDeskReplyToIsNotNull < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX_TABLE = :issues
  INDEX_NAME = 'idx_on_issues_where_service_desk_reply_to_is_not_null'

  def up
    Gitlab::BackgroundMigration.steal('PopulateIssueEmailParticipants')
    remove_concurrent_index_by_name INDEX_TABLE, INDEX_NAME
  end

  def down
    add_concurrent_index(INDEX_TABLE, [:id], name: INDEX_NAME, where: 'service_desk_reply_to IS NOT NULL')
  end
end