[ARVADOS] created: 5563150b747beb8ed580d74df4423c4bc2e37aca

git at public.curoverse.com git at public.curoverse.com
Thu Sep 18 10:36:00 EDT 2014


        at  5563150b747beb8ed580d74df4423c4bc2e37aca (commit)


commit 5563150b747beb8ed580d74df4423c4bc2e37aca
Author: Tim Pierce <twp at curoverse.com>
Date:   Thu Sep 18 10:35:05 2014 -0400

    3927: add NOT NULL constraint to User.owner_uuid
    
    Added a migration setting all users with null owner_uuid to
    system_user_uuid, and enforced a NOT NULL constraint on that column.

diff --git a/services/api/db/migrate/20140918141529_change_user_owner_uuid_not_null.rb b/services/api/db/migrate/20140918141529_change_user_owner_uuid_not_null.rb
new file mode 100644
index 0000000..0712ecd
--- /dev/null
+++ b/services/api/db/migrate/20140918141529_change_user_owner_uuid_not_null.rb
@@ -0,0 +1,10 @@
+class ChangeUserOwnerUuidNotNull < ActiveRecord::Migration
+  def up
+    User.update_all({owner_uuid: system_user_uuid}, 'owner_uuid is null')
+    change_column :users, :owner_uuid, :string, :null => false
+  end
+
+  def down
+    change_column :users, :owner_uuid, :string, :null => true
+  end
+end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index bd69102..9ea7844 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -872,7 +872,7 @@ ALTER SEQUENCE traits_id_seq OWNED BY traits.id;
 CREATE TABLE users (
     id integer NOT NULL,
     uuid character varying(255),
-    owner_uuid character varying(255),
+    owner_uuid character varying(255) NOT NULL,
     created_at timestamp without time zone NOT NULL,
     modified_by_client_uuid character varying(255),
     modified_by_user_uuid character varying(255),
@@ -2018,4 +2018,6 @@ INSERT INTO schema_migrations (version) VALUES ('20140828141043');
 
 INSERT INTO schema_migrations (version) VALUES ('20140909183946');
 
-INSERT INTO schema_migrations (version) VALUES ('20140911221252');
\ No newline at end of file
+INSERT INTO schema_migrations (version) VALUES ('20140911221252');
+
+INSERT INTO schema_migrations (version) VALUES ('20140918141529');
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list