diff options
author | MFijak <[email protected]> | 2022-10-20 15:31:53 +0200 |
---|---|---|
committer | MFijak <[email protected]> | 2022-10-20 15:31:53 +0200 |
commit | 21bc3bfd538157b341191c9caeddc86ca6fe49c3 (patch) | |
tree | 592d28e3537f97489f12074bb9c4d2f91e5aed83 /migrations | |
parent | 4cb5122e908b57efa1bd1b3c0a8707f129cb4823 (diff) | |
download | vaultwarden-21bc3bfd538157b341191c9caeddc86ca6fe49c3.tar.gz vaultwarden-21bc3bfd538157b341191c9caeddc86ca6fe49c3.zip |
group support
Diffstat (limited to 'migrations')
6 files changed, 78 insertions, 0 deletions
diff --git a/migrations/mysql/2022-07-27-110000_add_group_support/down.sql b/migrations/mysql/2022-07-27-110000_add_group_support/down.sql new file mode 100644 index 00000000..0ec5c501 --- /dev/null +++ b/migrations/mysql/2022-07-27-110000_add_group_support/down.sql @@ -0,0 +1,3 @@ +DROP TABLE `groups`; +DROP TABLE groups_users; +DROP TABLE collections_groups;
\ No newline at end of file diff --git a/migrations/mysql/2022-07-27-110000_add_group_support/up.sql b/migrations/mysql/2022-07-27-110000_add_group_support/up.sql new file mode 100644 index 00000000..6d40638a --- /dev/null +++ b/migrations/mysql/2022-07-27-110000_add_group_support/up.sql @@ -0,0 +1,23 @@ +CREATE TABLE `groups` ( + uuid CHAR(36) NOT NULL PRIMARY KEY, + organizations_uuid VARCHAR(40) NOT NULL REFERENCES organizations (uuid), + name VARCHAR(100) NOT NULL, + access_all BOOLEAN NOT NULL, + external_id VARCHAR(300) NULL, + creation_date DATETIME NOT NULL, + revision_date DATETIME NOT NULL +); + +CREATE TABLE groups_users ( + groups_uuid CHAR(36) NOT NULL REFERENCES `groups` (uuid), + users_organizations_uuid VARCHAR(36) NOT NULL REFERENCES users_organizations (uuid), + UNIQUE (groups_uuid, users_organizations_uuid) +); + +CREATE TABLE collections_groups ( + collections_uuid VARCHAR(40) NOT NULL REFERENCES collections (uuid), + groups_uuid CHAR(36) 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 diff --git a/migrations/postgresql/2022-07-27-110000_add_group_support/down.sql b/migrations/postgresql/2022-07-27-110000_add_group_support/down.sql new file mode 100644 index 00000000..9a12d694 --- /dev/null +++ b/migrations/postgresql/2022-07-27-110000_add_group_support/down.sql @@ -0,0 +1,3 @@ +DROP TABLE groups; +DROP TABLE groups_users; +DROP TABLE collections_groups;
\ No newline at end of file diff --git a/migrations/postgresql/2022-07-27-110000_add_group_support/up.sql b/migrations/postgresql/2022-07-27-110000_add_group_support/up.sql new file mode 100644 index 00000000..5eed1df3 --- /dev/null +++ b/migrations/postgresql/2022-07-27-110000_add_group_support/up.sql @@ -0,0 +1,23 @@ +CREATE TABLE groups ( + uuid CHAR(36) NOT NULL PRIMARY KEY, + organizations_uuid VARCHAR(40) NOT NULL REFERENCES organizations (uuid), + name VARCHAR(100) NOT NULL, + access_all BOOLEAN NOT NULL, + external_id VARCHAR(300) NULL, + creation_date TIMESTAMP NOT NULL, + revision_date TIMESTAMP NOT NULL +); + +CREATE TABLE groups_users ( + groups_uuid CHAR(36) NOT NULL REFERENCES groups (uuid), + users_organizations_uuid VARCHAR(36) NOT NULL REFERENCES users_organizations (uuid), + PRIMARY KEY (groups_uuid, users_organizations_uuid) +); + +CREATE TABLE collections_groups ( + collections_uuid VARCHAR(40) NOT NULL REFERENCES collections (uuid), + groups_uuid CHAR(36) NOT NULL REFERENCES groups (uuid), + read_only BOOLEAN NOT NULL, + hide_passwords BOOLEAN NOT NULL, + PRIMARY KEY (collections_uuid, groups_uuid) +);
\ No newline at end of file diff --git a/migrations/sqlite/2022-07-27-110000_add_group_support/down.sql b/migrations/sqlite/2022-07-27-110000_add_group_support/down.sql new file mode 100644 index 00000000..9a12d694 --- /dev/null +++ b/migrations/sqlite/2022-07-27-110000_add_group_support/down.sql @@ -0,0 +1,3 @@ +DROP TABLE groups; +DROP TABLE groups_users; +DROP TABLE collections_groups;
\ No newline at end of file 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 |