Merge branch '18865-collection-permission-links'
[arvados.git] / services / api / db / migrate / 20150216193428_collection_name_owner_unique_only_non_expired.rb
index 92856882d4cb3ecba2b5620b8232a0294fefbb91..72ef88c18589f73650c5d0db1950dc3b8371c483 100644 (file)
@@ -1,4 +1,8 @@
-class CollectionNameOwnerUniqueOnlyNonExpired < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class CollectionNameOwnerUniqueOnlyNonExpired < ActiveRecord::Migration[4.2]
   def find_index
     indexes = ActiveRecord::Base.connection.indexes('collections')
     name_owner_index = indexes.select do |index|
@@ -17,8 +21,7 @@ class CollectionNameOwnerUniqueOnlyNonExpired < ActiveRecord::Migration
   def down
     # it failed during up. is it going to pass now? should we do nothing?
     remove_index :collections, :name => 'collection_owner_uuid_name_unique' if !find_index.empty?
-    # and this is failing ...
-    # add_index(:collections, [:owner_uuid, :name], unique: true,
-    #          name: 'collection_owner_uuid_name_unique')
+    add_index(:collections, [:owner_uuid, :name], unique: true,
+              name: 'collection_owner_uuid_name_unique')
   end
 end