aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema_0067-user-roles.sql
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-05-29 09:23:25 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-05-29 09:23:25 +0100
commitf5b647053043afe0de18db327ea9ae4b6665daf2 (patch)
tree0a70171cd4975a4b1f45d42529922cb8f9b19b7b /db/schema_0067-user-roles.sql
parent0ed870721f4d257a71d929f73b6f4be80a5afe01 (diff)
parent4b88125da243aba9ad9754619c53cd5c50512c6d (diff)
Merge branch 'roles'
Diffstat (limited to 'db/schema_0067-user-roles.sql')
-rw-r--r--db/schema_0067-user-roles.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/schema_0067-user-roles.sql b/db/schema_0067-user-roles.sql
new file mode 100644
index 000000000..d3d773105
--- /dev/null
+++ b/db/schema_0067-user-roles.sql
@@ -0,0 +1,19 @@
+BEGIN;
+
+-- roles table
+create table roles (
+ id serial not null primary key,
+ body_id integer not null references body(id) ON DELETE CASCADE,
+ name text,
+ permissions text ARRAY,
+ unique(body_id, name)
+);
+
+-- Record which role(s) each user holds
+create table user_roles (
+ id serial not null primary key,
+ role_id integer not null references roles(id) ON DELETE CASCADE,
+ user_id integer not null references users(id) ON DELETE CASCADE
+);
+
+COMMIT;