[ARVADOS] updated: 8c629ffa55a646fdab671dd6b6d0a292dcea2510

git at public.curoverse.com git at public.curoverse.com
Mon Feb 16 15:51:36 EST 2015


Summary of changes:
 COPYING                                                 |  2 +-
 ...428_collection_name_owner_unique_only_non_expired.rb | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

       via  8c629ffa55a646fdab671dd6b6d0a292dcea2510 (commit)
       via  a002d3ef4bdf5f9ca4b1bd79c000cf695dc59d8b (commit)
       via  daaeb7a23e8a5baf82e3af0f280856862dbc5aa7 (commit)
      from  399366e7e32906099d22acddf44ad0cd2ca9a1e1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 8c629ffa55a646fdab671dd6b6d0a292dcea2510
Merge: a002d3e daaeb7a
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Mon Feb 16 15:31:55 2015 -0500

    Merge branch 'master' into 5197-collection-name-owner-unique


commit a002d3ef4bdf5f9ca4b1bd79c000cf695dc59d8b
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Mon Feb 16 15:31:30 2015 -0500

    5197: updated migration script

diff --git a/services/api/db/migrate/20150216193428_collection_name_owner_unique_only_non_expired.rb b/services/api/db/migrate/20150216193428_collection_name_owner_unique_only_non_expired.rb
index 1124d5e..9285688 100644
--- a/services/api/db/migrate/20150216193428_collection_name_owner_unique_only_non_expired.rb
+++ b/services/api/db/migrate/20150216193428_collection_name_owner_unique_only_non_expired.rb
@@ -1,6 +1,14 @@
 class CollectionNameOwnerUniqueOnlyNonExpired < ActiveRecord::Migration
+  def find_index
+    indexes = ActiveRecord::Base.connection.indexes('collections')
+    name_owner_index = indexes.select do |index|
+      index.name == 'collection_owner_uuid_name_unique'
+    end
+    name_owner_index
+  end
+
   def up
-    remove_index :collections, :name => 'collection_owner_uuid_name_unique'
+    remove_index :collections, :name => 'collection_owner_uuid_name_unique' if !find_index.empty?
     add_index(:collections, [:owner_uuid, :name], unique: true,
               where: 'expires_at is null',
               name: 'collection_owner_uuid_name_unique')
@@ -8,8 +16,9 @@ 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'
-    add_index(:collections, [:owner_uuid, :name], unique: true,
-              name: 'collection_owner_uuid_name_unique')
+    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')
   end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list