[ARVADOS] created: 1.2.0-61-ge37b9b659

Git user git at public.curoverse.com
Sat Sep 15 12:15:15 EDT 2018


        at  e37b9b6599f427520100aa262bcd65d6596bdbfd (commit)


commit e37b9b6599f427520100aa262bcd65d6596bdbfd
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Fri Sep 14 13:11:42 2018 -0300

    13561: Add initial collection version information to the database
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/db/migrate/20180913175443_add_version_info_to_collections.rb b/services/api/db/migrate/20180913175443_add_version_info_to_collections.rb
new file mode 100644
index 000000000..b5378d3a1
--- /dev/null
+++ b/services/api/db/migrate/20180913175443_add_version_info_to_collections.rb
@@ -0,0 +1,10 @@
+class AddVersionInfoToCollections < ActiveRecord::Migration
+  def change
+    # Do changes in bulk to save time on huge tables
+    change_table :collections, :bulk => true do |t|
+      t.string :current_version_uuid
+      t.integer :version, null: false, default: 1
+      t.index [:current_version_uuid, :version], unique: true
+    end
+  end
+end
diff --git a/services/api/db/migrate/20180915155335_set_current_version_uuid_on_collections.rb b/services/api/db/migrate/20180915155335_set_current_version_uuid_on_collections.rb
new file mode 100644
index 000000000..b205eae89
--- /dev/null
+++ b/services/api/db/migrate/20180915155335_set_current_version_uuid_on_collections.rb
@@ -0,0 +1,9 @@
+class SetCurrentVersionUuidOnCollections < ActiveRecord::Migration
+  def up
+    # Set the current version uuid as itself
+    Collection.where(current_version_uuid: nil).update_all("current_version_uuid=uuid")
+  end
+
+  def down
+  end
+end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index 427c9afb5..d646d609b 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -172,7 +172,9 @@ CREATE TABLE public.collections (
     is_trashed boolean DEFAULT false NOT NULL,
     storage_classes_desired jsonb DEFAULT '["default"]'::jsonb,
     storage_classes_confirmed jsonb DEFAULT '[]'::jsonb,
-    storage_classes_confirmed_at timestamp without time zone
+    storage_classes_confirmed_at timestamp without time zone,
+    current_version_uuid character varying,
+    version integer DEFAULT 1 NOT NULL
 );
 
 
@@ -1782,6 +1784,13 @@ CREATE INDEX index_collections_on_created_at ON public.collections USING btree (
 
 
 --
+-- Name: index_collections_on_current_version_uuid_and_version; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_collections_on_current_version_uuid_and_version ON public.collections USING btree (current_version_uuid, version);
+
+
+--
 -- Name: index_collections_on_delete_at; Type: INDEX; Schema: public; Owner: -
 --
 
@@ -3169,3 +3178,7 @@ INSERT INTO schema_migrations (version) VALUES ('20180824155207');
 
 INSERT INTO schema_migrations (version) VALUES ('20180904110712');
 
+INSERT INTO schema_migrations (version) VALUES ('20180913175443');
+
+INSERT INTO schema_migrations (version) VALUES ('20180915155335');
+

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list