summaryrefslogtreecommitdiff
path: root/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb
blob: 2c65a4ae4f5e3f6406c61db3206c86321c2f16f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class AddIndexOnMergeRequestDiffsMergeRequestIdAndId < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index(:merge_request_diffs, [:merge_request_id, :id])
  end

  def down
    if index_exists?(:merge_request_diffs, [:merge_request_id, :id])
      remove_concurrent_index(:merge_request_diffs, [:merge_request_id, :id])
    end
  end
end