blob: 077e8ed4bbe3a5b2ba08b392ce46b2b936691a5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# frozen_string_literal: true
class AddIndexWithTargetTypeToTodos < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
INDEX_FOR_PROJECTS_NAME = 'index_requirements_project_id_user_id_id_and_target_type'
INDEX_FOR_TARGET_TYPE_NAME = 'index_requirements_user_id_and_target_type'
def up
add_concurrent_index :todos, [:project_id, :user_id, :id, :target_type], name: INDEX_FOR_PROJECTS_NAME
add_concurrent_index :todos, [:user_id, :target_type], name: INDEX_FOR_TARGET_TYPE_NAME
end
def down
remove_concurrent_index_by_name :todos, INDEX_FOR_PROJECTS_NAME
remove_concurrent_index_by_name :todos, INDEX_FOR_TARGET_TYPE_NAME
end
end
|