--- /dev/null
+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
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
);
CREATE INDEX index_collections_on_created_at ON public.collections USING btree (created_at);
+--
+-- 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: -
--
INSERT INTO schema_migrations (version) VALUES ('20180904110712');
+INSERT INTO schema_migrations (version) VALUES ('20180913175443');
+
+INSERT INTO schema_migrations (version) VALUES ('20180915155335');
+