summaryrefslogtreecommitdiff
path: root/db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb
blob: 1ec6bc0bf2e05897ea294392c5289f8cc0f6fae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

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

  DOWNTIME = false
  INDEX_NAME = "idx_mrs_on_target_id_and_created_at_and_state_id"

  disable_ddl_transaction!

  def up
    add_concurrent_index :merge_requests, %i[target_project_id state_id created_at id], name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :merge_requests, INDEX_NAME
  end
end