blob: 804b20a38e9acb723b2812ea7947a6ee429be319 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# frozen_string_literal: true
class RemoveTmpEmptyTraversalIdsChildNamespaceIndex < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
CHILD_INDEX_NAME = 'tmp_index_namespaces_empty_traversal_ids_with_child_namespaces'
def up
remove_concurrent_index :namespaces, :id, name: CHILD_INDEX_NAME
end
def down
where_sql = "parent_id IS NOT NULL AND traversal_ids = '{}'"
add_concurrent_index :namespaces, :id, where: where_sql, name: CHILD_INDEX_NAME
end
end
|