2020-06-11 03:08:30 +00:00
|
|
|
# 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
|
2020-07-07 03:09:32 +00:00
|
|
|
remove_concurrent_index_by_name :merge_requests, INDEX_NAME
|
2020-06-11 03:08:30 +00:00
|
|
|
end
|
|
|
|
end
|