From 68cfd90f71ef135386cf4d76a0e43e67211cf57f Mon Sep 17 00:00:00 2001 From: MFijak Date: Wed, 27 Jul 2022 16:41:18 +0200 Subject: [PATCH] schema added --- src/db/schemas/mysql/schema.rs | 36 +++++++++++++++++++++++++++++ src/db/schemas/postgresql/schema.rs | 36 +++++++++++++++++++++++++++++ src/db/schemas/sqlite/schema.rs | 36 +++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) diff --git a/src/db/schemas/mysql/schema.rs b/src/db/schemas/mysql/schema.rs index a49159f2..b1ba25fe 100644 --- a/src/db/schemas/mysql/schema.rs +++ b/src/db/schemas/mysql/schema.rs @@ -220,6 +220,34 @@ table! { } } +table! { + groups (uuid) { + uuid -> Text, + organizations_uuid -> Text, + name -> Text, + access_all -> Bool, + external_id -> Text, + creation_date -> Timestamp, + revision_date -> Timestamp + } +} + +table! { + groups_users (groups_uuid, users_organizations_uuid) { + groups_uuid -> Text, + users_organizations_uuid -> Text + } +} + +table! { + collection_groups (collections_uuid, groups_uuid) { + collections_uuid -> Text, + groups_uuid -> Text, + read_only -> Bool, + hide_passwords -> Bool + } +} + joinable!(attachments -> ciphers (cipher_uuid)); joinable!(ciphers -> organizations (organization_uuid)); joinable!(ciphers -> users (user_uuid)); @@ -239,6 +267,11 @@ joinable!(users_collections -> users (user_uuid)); joinable!(users_organizations -> organizations (org_uuid)); joinable!(users_organizations -> users (user_uuid)); joinable!(emergency_access -> users (grantor_uuid)); +joinable!(groups -> organizations (organizations_uuid)); +joinable!(groups_users -> users_organizations (users_organizations_uuid)); +joinable!(groups_users -> groups (groups_uuid)); +joinable!(collection_groups -> collections (collections_uuid)); +joinable!(collection_groups -> groups (groups_uuid)); allow_tables_to_appear_in_same_query!( attachments, @@ -257,4 +290,7 @@ allow_tables_to_appear_in_same_query!( users_collections, users_organizations, emergency_access, + groups, + groups_users, + collection_groups, ); diff --git a/src/db/schemas/postgresql/schema.rs b/src/db/schemas/postgresql/schema.rs index 9fd6fd97..5ff0d60b 100644 --- a/src/db/schemas/postgresql/schema.rs +++ b/src/db/schemas/postgresql/schema.rs @@ -220,6 +220,34 @@ table! { } } +table! { + groups (uuid) { + uuid -> Text, + organizations_uuid -> Text, + name -> Text, + access_all -> Bool, + external_id -> Text, + creation_date -> Timestamp, + revision_date -> Timestamp, + } +} + +table! { + groups_users (groups_uuid, users_organizations_uuid) { + groups_uuid -> Text, + users_organizations_uuid -> Text, + } +} + +table! { + collection_groups (collections_uuid, groups_uuid) { + collections_uuid -> Text, + groups_uuid -> Text, + read_only -> Bool, + hide_passwords -> Bool, + } +} + joinable!(attachments -> ciphers (cipher_uuid)); joinable!(ciphers -> organizations (organization_uuid)); joinable!(ciphers -> users (user_uuid)); @@ -239,6 +267,11 @@ joinable!(users_collections -> users (user_uuid)); joinable!(users_organizations -> organizations (org_uuid)); joinable!(users_organizations -> users (user_uuid)); joinable!(emergency_access -> users (grantor_uuid)); +joinable!(groups -> organizations (organizations_uuid)); +joinable!(groups_users -> users_organizations (users_organizations_uuid)); +joinable!(groups_users -> groups (groups_uuid)); +joinable!(collection_groups -> collections (collections_uuid)); +joinable!(collection_groups -> groups (groups_uuid)); allow_tables_to_appear_in_same_query!( attachments, @@ -257,4 +290,7 @@ allow_tables_to_appear_in_same_query!( users_collections, users_organizations, emergency_access, + groups, + groups_users, + collection_groups, ); diff --git a/src/db/schemas/sqlite/schema.rs b/src/db/schemas/sqlite/schema.rs index 9fd6fd97..3657f00b 100644 --- a/src/db/schemas/sqlite/schema.rs +++ b/src/db/schemas/sqlite/schema.rs @@ -220,6 +220,34 @@ table! { } } +table! { + groups (uuid) { + uuid -> Text, + organizations_uuid -> Text, + name -> Text, + access_all -> Bool, + external_id -> Text, + creation_date -> Timestamp, + revision_date -> Timestamp + } +} + +table! { + groups_users (groups_uuid, users_organizations_uuid) { + groups_uuid -> Text, + users_organizations_uuid -> Text + } +} + +table! { + collection_groups (collections_uuid, groups_uuid) { + collections_uuid -> Text, + groups_uuid -> Text, + read_only -> Bool, + hide_passwords -> Bool + } +} + joinable!(attachments -> ciphers (cipher_uuid)); joinable!(ciphers -> organizations (organization_uuid)); joinable!(ciphers -> users (user_uuid)); @@ -239,6 +267,11 @@ joinable!(users_collections -> users (user_uuid)); joinable!(users_organizations -> organizations (org_uuid)); joinable!(users_organizations -> users (user_uuid)); joinable!(emergency_access -> users (grantor_uuid)); +joinable!(groups -> organizations (organizations_uuid)); +joinable!(groups_users -> users_organizations (users_organizations_uuid)); +joinable!(groups_users -> groups (groups_uuid)); +joinable!(collection_groups -> collections (collections_uuid)); +joinable!(collection_groups -> groups (groups_uuid)); allow_tables_to_appear_in_same_query!( attachments, @@ -257,4 +290,7 @@ allow_tables_to_appear_in_same_query!( users_collections, users_organizations, emergency_access, + groups, + groups_users, + collection_groups, );