X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f7e3001b53e9f26fd1d413308093bb9700bb9287..02d7f4e820b65d83a5e3709dc14b6d72b9f5ab49:/services/api/db/migrate/20141208164553_owner_uuid_index.rb diff --git a/services/api/db/migrate/20141208164553_owner_uuid_index.rb b/services/api/db/migrate/20141208164553_owner_uuid_index.rb index 35358a0736..a6d4e76404 100644 --- a/services/api/db/migrate/20141208164553_owner_uuid_index.rb +++ b/services/api/db/migrate/20141208164553_owner_uuid_index.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class OwnerUuidIndex < ActiveRecord::Migration def tables_with_owner_uuid %w{api_clients authorized_keys collections groups humans @@ -14,7 +18,13 @@ class OwnerUuidIndex < ActiveRecord::Migration def down tables_with_owner_uuid.each do |table| - remove_index table.to_sym, :owner_uuid + indexes = ActiveRecord::Base.connection.indexes(table) + owner_uuid_index = indexes.select do |index| + index.columns == ['owner_uuid'] + end + if !owner_uuid_index.empty? + remove_index table.to_sym, :owner_uuid + end end end end