blob: 498090c3ab9ca545a041454952d90078b77d9245 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
class ReplaceProjectAuthorizationsProjectIdIndex < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
OLD_INDEX_NAME = 'index_project_authorizations_on_project_id'
NEW_INDEX_NAME = 'index_project_authorizations_on_project_id_user_id'
def up
add_concurrent_index(:project_authorizations, [:project_id, :user_id], name: NEW_INDEX_NAME)
remove_concurrent_index_by_name(:project_authorizations, OLD_INDEX_NAME)
end
def down
add_concurrent_index(:project_authorizations, :project_id, name: OLD_INDEX_NAME)
remove_concurrent_index_by_name(:project_authorizations, NEW_INDEX_NAME)
end
end
|