1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class RecreateCollectionUniqueNameIndex < ActiveRecord::Migration[4.2]
7 Collection.transaction do
8 remove_index(:collections,
9 name: 'index_collections_on_owner_uuid_and_name')
10 add_index(:collections, [:owner_uuid, :name],
12 where: 'is_trashed = false AND current_version_uuid = uuid',
13 name: 'index_collections_on_owner_uuid_and_name')
18 Collection.transaction do
19 remove_index(:collections,
20 name: 'index_collections_on_owner_uuid_and_name')
21 add_index(:collections, [:owner_uuid, :name],
23 where: 'is_trashed = false',
24 name: 'index_collections_on_owner_uuid_and_name')