aboutsummaryrefslogtreecommitdiff
path: root/migrations/sqlite/2022-07-27-110000_add_group_support/up.sql
diff options
context:
space:
mode:
Diffstat (limited to 'migrations/sqlite/2022-07-27-110000_add_group_support/up.sql')
-rw-r--r--migrations/sqlite/2022-07-27-110000_add_group_support/up.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/migrations/sqlite/2022-07-27-110000_add_group_support/up.sql b/migrations/sqlite/2022-07-27-110000_add_group_support/up.sql
new file mode 100644
index 00000000..0523c760
--- /dev/null
+++ b/migrations/sqlite/2022-07-27-110000_add_group_support/up.sql
@@ -0,0 +1,23 @@
+CREATE TABLE groups (
+ uuid TEXT NOT NULL PRIMARY KEY,
+ organizations_uuid TEXT NOT NULL REFERENCES organizations (uuid),
+ name TEXT NOT NULL,
+ access_all BOOLEAN NOT NULL,
+ external_id TEXT NULL,
+ creation_date TIMESTAMP NOT NULL,
+ revision_date TIMESTAMP NOT NULL
+);
+
+CREATE TABLE groups_users (
+ groups_uuid TEXT NOT NULL REFERENCES groups (uuid),
+ users_organizations_uuid TEXT NOT NULL REFERENCES users_organizations (uuid),
+ UNIQUE (groups_uuid, users_organizations_uuid)
+);
+
+CREATE TABLE collections_groups (
+ collections_uuid TEXT NOT NULL REFERENCES collections (uuid),
+ groups_uuid TEXT NOT NULL REFERENCES groups (uuid),
+ read_only BOOLEAN NOT NULL,
+ hide_passwords BOOLEAN NOT NULL,
+ UNIQUE (collections_uuid, groups_uuid)
+); \ No newline at end of file