blob: 7602ad00796e98196d6d1a7fc9f47c77bc81b9ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# frozen_string_literal: true
class AddPartialIndexOnLockedStateIdToMergeRequests < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = "idx_merge_requests_on_target_project_id_and_locked_state"
LOCKED_STATE_ID = 4
disable_ddl_transaction!
def up
add_concurrent_index :merge_requests, :target_project_id, where: "(state_id = #{LOCKED_STATE_ID})", name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :merge_requests, INDEX_NAME
end
end
|