[ARVADOS] updated: 399366e7e32906099d22acddf44ad0cd2ca9a1e1

git at public.curoverse.com git at public.curoverse.com
Mon Feb 16 15:10:03 EST 2015


Summary of changes:
 ...93428_collection_name_owner_unique_only_non_expired.rb | 15 +++++++++++++++
 services/api/db/structure.sql                             | 10 ++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 services/api/db/migrate/20150216193428_collection_name_owner_unique_only_non_expired.rb

       via  399366e7e32906099d22acddf44ad0cd2ca9a1e1 (commit)
      from  fb179796cc5605ae8c825523c015a9b00f467550 (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 399366e7e32906099d22acddf44ad0cd2ca9a1e1
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Mon Feb 16 14:49:27 2015 -0500

    5197: update the collection_owner_uuid_name_unique index to use expires_at is null where clause.

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
new file mode 100644
index 0000000..1124d5e
--- /dev/null
+++ b/services/api/db/migrate/20150216193428_collection_name_owner_unique_only_non_expired.rb
@@ -0,0 +1,15 @@
+class CollectionNameOwnerUniqueOnlyNonExpired < ActiveRecord::Migration
+  def up
+    remove_index :collections, :name => 'collection_owner_uuid_name_unique'
+    add_index(:collections, [:owner_uuid, :name], unique: true,
+              where: 'expires_at is null',
+              name: 'collection_owner_uuid_name_unique')
+  end
+
+  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')
+  end
+end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index e2c6b66..aded465 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -160,7 +160,6 @@ CREATE TABLE collections (
     modified_at timestamp without time zone,
     portable_data_hash character varying(255),
     redundancy integer,
-    redundancy_confirmed_by_client_uuid character varying(255),
     redundancy_confirmed_at timestamp without time zone,
     redundancy_confirmed_as integer,
     updated_at timestamp without time zone NOT NULL,
@@ -170,6 +169,7 @@ CREATE TABLE collections (
     description character varying(524288),
     properties text,
     expires_at date,
+    redundancy_confirmed_by_client_uuid character varying(255),
     file_names character varying(8192)
 );
 
@@ -1304,14 +1304,14 @@ CREATE INDEX authorized_keys_search_index ON authorized_keys USING btree (uuid,
 -- Name: collection_owner_uuid_name_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
 
-CREATE UNIQUE INDEX collection_owner_uuid_name_unique ON collections USING btree (owner_uuid, name);
+CREATE UNIQUE INDEX collection_owner_uuid_name_unique ON collections USING btree (owner_uuid, name) WHERE (expires_at IS NULL);
 
 
 --
 -- Name: collections_full_text_search_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
 
-CREATE INDEX collections_full_text_search_idx ON collections USING gin (to_tsvector('english'::regconfig, (((((((((((((((((((COALESCE(owner_uuid, ''::character varying))::text || ' '::text) || (COALESCE(modified_by_client_uuid, ''::character varying))::text) || ' '::text) || (COALESCE(modified_by_user_uuid, ''::character varying))::text) || ' '::text) || (COALESCE(portable_data_hash, ''::character varying))::text) || ' '::text) || (COALESCE(redundancy_confirmed_by_client_uuid, ''::character varying))::text) || ' '::text) || (COALESCE(uuid, ''::character varying))::text) || ' '::text) || (COALESCE(name, ''::character varying))::text) || ' '::text) || (COALESCE(description, ''::character varying))::text) || ' '::text) || COALESCE(properties, ''::text)) || ' '::text) || (COALESCE(file_names, ''::character varying))::text)));
+CREATE INDEX collections_full_text_search_idx ON collections USING gin (to_tsvector('english'::regconfig, (((((((((((((((((COALESCE(owner_uuid, ''::character varying))::text || ' '::text) || (COALESCE(modified_by_client_uuid, ''::character varying))::text) || ' '::text) || (COALESCE(modified_by_user_uuid, ''::character varying))::text) || ' '::text) || (COALESCE(portable_data_hash, ''::character varying))::text) || ' '::text) || (COALESCE(uuid, ''::character varying))::text) || ' '::text) || (COALESCE(name, ''::character varying))::text) || ' '::text) || (COALESCE(description, ''::character varying))::text) || ' '::text) || COALESCE(properties, ''::text)) || ' '::text) || (COALESCE(redundancy_confirmed_by_client_uuid, ''::character varying))::text)));
 
 
 --
@@ -2357,4 +2357,6 @@ INSERT INTO schema_migrations (version) VALUES ('20150123142953');
 
 INSERT INTO schema_migrations (version) VALUES ('20150203180223');
 
-INSERT INTO schema_migrations (version) VALUES ('20150206210804');
\ No newline at end of file
+INSERT INTO schema_migrations (version) VALUES ('20150206210804');
+
+INSERT INTO schema_migrations (version) VALUES ('20150216193428');
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list