blob: bcb0e32a4e78d03c2273b9b13fa1f1544f73b284 (
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 AddWorkItemTypeNameUniqueIndexNullNamespaces < Gitlab::Database::Migration[1.0]
INDEX_NAME = :idx_work_item_types_on_namespace_id_and_name_null_namespace
disable_ddl_transaction!
def up
add_concurrent_index :work_item_types,
'TRIM(BOTH FROM LOWER(name)), (namespace_id IS NULL)',
unique: true,
name: INDEX_NAME,
where: 'namespace_id IS NULL'
end
def down
remove_concurrent_index_by_name :work_item_types, INDEX_NAME
end
end
|