projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
18164: Improve permission query for links
[arvados.git]
/
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 35358a07364acef02e536a5a87cbf1358d3da72d..a3f68954b23a12d4d9668ab1d19730a6e7795ff7 100644
(file)
--- a/
services/api/db/migrate/20141208164553_owner_uuid_index.rb
+++ b/
services/api/db/migrate/20141208164553_owner_uuid_index.rb
@@
-1,4
+1,8
@@
-class OwnerUuidIndex < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class OwnerUuidIndex < ActiveRecord::Migration[4.2]
def tables_with_owner_uuid
%w{api_clients authorized_keys collections groups humans
job_tasks jobs keep_disks keep_services links logs
def tables_with_owner_uuid
%w{api_clients authorized_keys collections groups humans
job_tasks jobs keep_disks keep_services links logs
@@
-14,7
+18,13
@@
class OwnerUuidIndex < ActiveRecord::Migration
def down
tables_with_owner_uuid.each do |table|
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
end
end
end