[ARVADOS] created: 1.1.4-381-g5f75e2d
Git user
git at public.curoverse.com
Fri Jun 8 09:00:16 EDT 2018
at 5f75e2db42cea65e6f4e6b8c2b1b1dfb8e748c05 (commit)
commit 5f75e2db42cea65e6f4e6b8c2b1b1dfb8e748c05
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Fri Jun 8 08:59:56 2018 -0400
13562: Add "properties" field to groups, supports subproperty query.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb
index fe18367..7a7f0a3 100644
--- a/services/api/app/models/group.rb
+++ b/services/api/app/models/group.rb
@@ -12,6 +12,8 @@ class Group < ArvadosModel
include CanBeAnOwner
include Trashable
+ serialize :properties, Hash
+
after_create :invalidate_permissions_cache
after_update :maybe_invalidate_permissions_cache
before_create :assign_name
@@ -24,6 +26,7 @@ class Group < ArvadosModel
t.add :delete_at
t.add :trash_at
t.add :is_trashed
+ t.add :properties
end
def maybe_invalidate_permissions_cache
diff --git a/services/api/db/migrate/20180608123145_add_properties_to_groups.rb b/services/api/db/migrate/20180608123145_add_properties_to_groups.rb
new file mode 100644
index 0000000..a969456
--- /dev/null
+++ b/services/api/db/migrate/20180608123145_add_properties_to_groups.rb
@@ -0,0 +1,11 @@
+class AddPropertiesToGroups < ActiveRecord::Migration
+ def up
+ add_column :groups, :properties, :jsonb, default: {}
+ ActiveRecord::Base.connection.execute("CREATE INDEX group_index_on_properties ON groups USING gin (properties);")
+ end
+
+ def down
+ ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS group_index_on_properties")
+ remove_column :groups, :properties
+ end
+end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index 0ab30c5..20ce89c 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -396,7 +396,8 @@ CREATE TABLE groups (
group_class character varying(255),
trash_at timestamp without time zone,
is_trashed boolean DEFAULT false NOT NULL,
- delete_at timestamp without time zone
+ delete_at timestamp without time zone,
+ properties jsonb DEFAULT '{}'::jsonb
);
@@ -1655,6 +1656,13 @@ CREATE INDEX containers_search_index ON containers USING btree (uuid, owner_uuid
--
+-- Name: group_index_on_properties; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX group_index_on_properties ON groups USING gin (properties);
+
+
+--
-- Name: groups_full_text_search_idx; Type: INDEX; Schema: public; Owner: -
--
@@ -3080,3 +3088,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180501182859');
INSERT INTO schema_migrations (version) VALUES ('20180514135529');
+INSERT INTO schema_migrations (version) VALUES ('20180608123145');
+
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list