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

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

  DOWNTIME = false
  INDEX_NAME = "index_merge_requests_on_target_project_id_and_squash_commit_sha"

  disable_ddl_transaction!

  def up
    add_concurrent_index :merge_requests,
      [:target_project_id, :squash_commit_sha],
      name: INDEX_NAME
  end

  def down
    remove_concurrent_index :merge_requests,
      [:target_project_id, :squash_commit_sha],
      name: INDEX_NAME
  end
end