committed by
							
								
								GitHub
							
						
					
				
				 75 changed files with 610 additions and 134 deletions
			
			
		@ -0,0 +1,62 @@ | 
				
			|||||
 | 
					CREATE TABLE users ( | 
				
			||||
 | 
					  uuid                CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  created_at          DATETIME NOT NULL, | 
				
			||||
 | 
					  updated_at          DATETIME NOT NULL, | 
				
			||||
 | 
					  email               VARCHAR(255) NOT NULL UNIQUE, | 
				
			||||
 | 
					  name                TEXT     NOT NULL, | 
				
			||||
 | 
					  password_hash       BLOB     NOT NULL, | 
				
			||||
 | 
					  salt                BLOB     NOT NULL, | 
				
			||||
 | 
					  password_iterations INTEGER  NOT NULL, | 
				
			||||
 | 
					  password_hint       TEXT, | 
				
			||||
 | 
					  `key`               TEXT     NOT NULL, | 
				
			||||
 | 
					  private_key         TEXT, | 
				
			||||
 | 
					  public_key          TEXT, | 
				
			||||
 | 
					  totp_secret         TEXT, | 
				
			||||
 | 
					  totp_recover        TEXT, | 
				
			||||
 | 
					  security_stamp      TEXT     NOT NULL, | 
				
			||||
 | 
					  equivalent_domains  TEXT     NOT NULL, | 
				
			||||
 | 
					  excluded_globals    TEXT     NOT NULL | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE devices ( | 
				
			||||
 | 
					  uuid          CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  created_at    DATETIME NOT NULL, | 
				
			||||
 | 
					  updated_at    DATETIME NOT NULL, | 
				
			||||
 | 
					  user_uuid     CHAR(36) NOT NULL REFERENCES users (uuid), | 
				
			||||
 | 
					  name          TEXT     NOT NULL, | 
				
			||||
 | 
					  type          INTEGER  NOT NULL, | 
				
			||||
 | 
					  push_token    TEXT, | 
				
			||||
 | 
					  refresh_token TEXT     NOT NULL | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE ciphers ( | 
				
			||||
 | 
					  uuid              CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  created_at        DATETIME NOT NULL, | 
				
			||||
 | 
					  updated_at        DATETIME NOT NULL, | 
				
			||||
 | 
					  user_uuid         CHAR(36) NOT NULL REFERENCES users (uuid), | 
				
			||||
 | 
					  folder_uuid       CHAR(36) REFERENCES folders (uuid), | 
				
			||||
 | 
					  organization_uuid CHAR(36), | 
				
			||||
 | 
					  type              INTEGER  NOT NULL, | 
				
			||||
 | 
					  name              TEXT     NOT NULL, | 
				
			||||
 | 
					  notes             TEXT, | 
				
			||||
 | 
					  fields            TEXT, | 
				
			||||
 | 
					  data              TEXT     NOT NULL, | 
				
			||||
 | 
					  favorite          BOOLEAN  NOT NULL | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE attachments ( | 
				
			||||
 | 
					  id          CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid), | 
				
			||||
 | 
					  file_name   TEXT    NOT NULL, | 
				
			||||
 | 
					  file_size   INTEGER NOT NULL | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE folders ( | 
				
			||||
 | 
					  uuid       CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  created_at DATETIME NOT NULL, | 
				
			||||
 | 
					  updated_at DATETIME NOT NULL, | 
				
			||||
 | 
					  user_uuid  CHAR(36) NOT NULL REFERENCES users (uuid), | 
				
			||||
 | 
					  name       TEXT     NOT NULL | 
				
			||||
 | 
					); | 
				
			||||
 | 
					   | 
				
			||||
@ -0,0 +1,30 @@ | 
				
			|||||
 | 
					CREATE TABLE collections ( | 
				
			||||
 | 
					  uuid     VARCHAR(40) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  org_uuid VARCHAR(40) NOT NULL REFERENCES organizations (uuid), | 
				
			||||
 | 
					  name     TEXT NOT NULL | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE organizations ( | 
				
			||||
 | 
					  uuid          VARCHAR(40) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  name          TEXT NOT NULL, | 
				
			||||
 | 
					  billing_email TEXT NOT NULL | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE users_collections ( | 
				
			||||
 | 
					  user_uuid       CHAR(36) NOT NULL REFERENCES users (uuid), | 
				
			||||
 | 
					  collection_uuid CHAR(36) NOT NULL REFERENCES collections (uuid), | 
				
			||||
 | 
					  PRIMARY KEY (user_uuid, collection_uuid) | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE users_organizations ( | 
				
			||||
 | 
					  uuid       CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  user_uuid  CHAR(36) NOT NULL REFERENCES users (uuid), | 
				
			||||
 | 
					  org_uuid   CHAR(36) NOT NULL REFERENCES organizations (uuid), | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					  access_all BOOLEAN NOT NULL, | 
				
			||||
 | 
					  `key`      TEXT    NOT NULL, | 
				
			||||
 | 
					  status     INTEGER NOT NULL, | 
				
			||||
 | 
					  type       INTEGER NOT NULL, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					  UNIQUE (user_uuid, org_uuid) | 
				
			||||
 | 
					); | 
				
			||||
@ -0,0 +1,34 @@ | 
				
			|||||
 | 
					ALTER TABLE ciphers RENAME TO oldCiphers; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE ciphers ( | 
				
			||||
 | 
					  uuid              CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  created_at        DATETIME NOT NULL, | 
				
			||||
 | 
					  updated_at        DATETIME NOT NULL, | 
				
			||||
 | 
					  user_uuid         CHAR(36) REFERENCES users (uuid), -- Make this optional | 
				
			||||
 | 
					  organization_uuid CHAR(36) REFERENCES organizations (uuid), -- Add reference to orgs table | 
				
			||||
 | 
					  -- Remove folder_uuid | 
				
			||||
 | 
					  type              INTEGER  NOT NULL, | 
				
			||||
 | 
					  name              TEXT     NOT NULL, | 
				
			||||
 | 
					  notes             TEXT, | 
				
			||||
 | 
					  fields            TEXT, | 
				
			||||
 | 
					  data              TEXT     NOT NULL, | 
				
			||||
 | 
					  favorite          BOOLEAN  NOT NULL | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE folders_ciphers ( | 
				
			||||
 | 
					  cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid), | 
				
			||||
 | 
					  folder_uuid CHAR(36) NOT NULL REFERENCES folders (uuid), | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					  PRIMARY KEY (cipher_uuid, folder_uuid) | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					INSERT INTO ciphers (uuid, created_at, updated_at, user_uuid, organization_uuid, type, name, notes, fields, data, favorite)  | 
				
			||||
 | 
					SELECT uuid, created_at, updated_at, user_uuid, organization_uuid, type, name, notes, fields, data, favorite FROM oldCiphers; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					INSERT INTO folders_ciphers (cipher_uuid, folder_uuid) | 
				
			||||
 | 
					SELECT uuid, folder_uuid FROM oldCiphers WHERE folder_uuid IS NOT NULL; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE oldCiphers; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					ALTER TABLE users_collections ADD COLUMN read_only BOOLEAN NOT NULL DEFAULT 0; -- False | 
				
			||||
@ -0,0 +1,5 @@ | 
				
			|||||
 | 
					CREATE TABLE ciphers_collections ( | 
				
			||||
 | 
					  cipher_uuid       CHAR(36) NOT NULL REFERENCES ciphers (uuid), | 
				
			||||
 | 
					  collection_uuid CHAR(36) NOT NULL REFERENCES collections (uuid), | 
				
			||||
 | 
					  PRIMARY KEY (cipher_uuid, collection_uuid) | 
				
			||||
 | 
					); | 
				
			||||
@ -0,0 +1,14 @@ | 
				
			|||||
 | 
					ALTER TABLE attachments RENAME TO oldAttachments; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					CREATE TABLE attachments ( | 
				
			||||
 | 
					  id          CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid), | 
				
			||||
 | 
					  file_name   TEXT    NOT NULL, | 
				
			||||
 | 
					  file_size   INTEGER NOT NULL | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					INSERT INTO attachments (id, cipher_uuid, file_name, file_size)  | 
				
			||||
 | 
					SELECT id, cipher_uuid, file_name, file_size FROM oldAttachments; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE oldAttachments; | 
				
			||||
@ -0,0 +1,15 @@ | 
				
			|||||
 | 
					CREATE TABLE twofactor ( | 
				
			||||
 | 
					  uuid      CHAR(36) NOT NULL PRIMARY KEY, | 
				
			||||
 | 
					  user_uuid CHAR(36) NOT NULL REFERENCES users (uuid), | 
				
			||||
 | 
					  type      INTEGER  NOT NULL, | 
				
			||||
 | 
					  enabled   BOOLEAN  NOT NULL, | 
				
			||||
 | 
					  data      TEXT     NOT NULL, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					  UNIQUE (user_uuid, type) | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					INSERT INTO twofactor (uuid, user_uuid, type, enabled, data)  | 
				
			||||
 | 
					SELECT UUID(), uuid, 0, 1, u.totp_secret FROM users u where u.totp_secret IS NOT NULL; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					UPDATE users SET totp_secret = NULL; -- Instead of recreating the table, just leave the columns empty | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			|||||
 | 
					CREATE TABLE invitations ( | 
				
			||||
 | 
					    email   VARCHAR(255) NOT NULL PRIMARY KEY | 
				
			||||
 | 
					); | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			|||||
 | 
					ALTER TABLE attachments | 
				
			||||
 | 
					    ADD COLUMN | 
				
			||||
 | 
					    `key` TEXT; | 
				
			||||
@ -0,0 +1,7 @@ | 
				
			|||||
 | 
					ALTER TABLE attachments CHANGE COLUMN akey `key` TEXT; | 
				
			||||
 | 
					ALTER TABLE ciphers CHANGE COLUMN atype type INTEGER NOT NULL; | 
				
			||||
 | 
					ALTER TABLE devices CHANGE COLUMN atype type INTEGER NOT NULL; | 
				
			||||
 | 
					ALTER TABLE twofactor CHANGE COLUMN atype type INTEGER NOT NULL; | 
				
			||||
 | 
					ALTER TABLE users CHANGE COLUMN akey `key` TEXT; | 
				
			||||
 | 
					ALTER TABLE users_organizations CHANGE COLUMN akey `key` TEXT; | 
				
			||||
 | 
					ALTER TABLE users_organizations CHANGE COLUMN atype type INTEGER NOT NULL; | 
				
			||||
@ -0,0 +1,7 @@ | 
				
			|||||
 | 
					ALTER TABLE attachments CHANGE COLUMN `key` akey TEXT; | 
				
			||||
 | 
					ALTER TABLE ciphers CHANGE COLUMN type atype INTEGER NOT NULL; | 
				
			||||
 | 
					ALTER TABLE devices CHANGE COLUMN type atype INTEGER NOT NULL; | 
				
			||||
 | 
					ALTER TABLE twofactor CHANGE COLUMN type atype INTEGER NOT NULL; | 
				
			||||
 | 
					ALTER TABLE users CHANGE COLUMN `key` akey TEXT; | 
				
			||||
 | 
					ALTER TABLE users_organizations CHANGE COLUMN `key` akey TEXT; | 
				
			||||
 | 
					ALTER TABLE users_organizations CHANGE COLUMN type atype INTEGER NOT NULL; | 
				
			||||
@ -0,0 +1,9 @@ | 
				
			|||||
 | 
					DROP TABLE users; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE devices; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE ciphers; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE attachments; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE folders; | 
				
			||||
@ -0,0 +1,8 @@ | 
				
			|||||
 | 
					DROP TABLE collections; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE organizations; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE users_collections; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE users_organizations; | 
				
			||||
@ -0,0 +1 @@ | 
				
			|||||
 | 
					DROP TABLE ciphers_collections; | 
				
			||||
@ -0,0 +1 @@ | 
				
			|||||
 | 
					-- This file should undo anything in `up.sql` | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			|||||
 | 
					ALTER TABLE devices | 
				
			||||
 | 
					    ADD COLUMN | 
				
			||||
 | 
					    twofactor_remember TEXT; | 
				
			||||
@ -0,0 +1,8 @@ | 
				
			|||||
 | 
					UPDATE users | 
				
			||||
 | 
					SET totp_secret = ( | 
				
			||||
 | 
					    SELECT twofactor.data FROM twofactor | 
				
			||||
 | 
					    WHERE twofactor.type = 0  | 
				
			||||
 | 
					    AND twofactor.user_uuid = users.uuid | 
				
			||||
 | 
					); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DROP TABLE twofactor; | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			|||||
 | 
					ALTER TABLE ciphers | 
				
			||||
 | 
					    ADD COLUMN | 
				
			||||
 | 
					    password_history TEXT; | 
				
			||||
@ -0,0 +1 @@ | 
				
			|||||
 | 
					DROP TABLE invitations; | 
				
			||||
@ -0,0 +1,7 @@ | 
				
			|||||
 | 
					ALTER TABLE users | 
				
			||||
 | 
					    ADD COLUMN | 
				
			||||
 | 
					    client_kdf_type INTEGER NOT NULL DEFAULT 0; -- PBKDF2 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					ALTER TABLE users | 
				
			||||
 | 
					    ADD COLUMN | 
				
			||||
 | 
					    client_kdf_iter INTEGER NOT NULL DEFAULT 5000; | 
				
			||||
@ -0,0 +1,7 @@ | 
				
			|||||
 | 
					ALTER TABLE attachments RENAME COLUMN akey TO key; | 
				
			||||
 | 
					ALTER TABLE ciphers RENAME COLUMN atype TO type; | 
				
			||||
 | 
					ALTER TABLE devices RENAME COLUMN atype TO type; | 
				
			||||
 | 
					ALTER TABLE twofactor RENAME COLUMN atype TO type; | 
				
			||||
 | 
					ALTER TABLE users RENAME COLUMN akey TO key; | 
				
			||||
 | 
					ALTER TABLE users_organizations RENAME COLUMN akey TO key; | 
				
			||||
 | 
					ALTER TABLE users_organizations RENAME COLUMN atype TO type; | 
				
			||||
@ -0,0 +1,7 @@ | 
				
			|||||
 | 
					ALTER TABLE attachments RENAME COLUMN key TO akey; | 
				
			||||
 | 
					ALTER TABLE ciphers RENAME COLUMN type TO atype; | 
				
			||||
 | 
					ALTER TABLE devices RENAME COLUMN type TO atype; | 
				
			||||
 | 
					ALTER TABLE twofactor RENAME COLUMN type TO atype; | 
				
			||||
 | 
					ALTER TABLE users RENAME COLUMN key TO akey; | 
				
			||||
 | 
					ALTER TABLE users_organizations RENAME COLUMN key TO akey; | 
				
			||||
 | 
					ALTER TABLE users_organizations RENAME COLUMN type TO atype; | 
				
			||||
@ -0,0 +1,172 @@ | 
				
			|||||
 | 
					table! { | 
				
			||||
 | 
					    attachments (id) { | 
				
			||||
 | 
					        id -> Varchar, | 
				
			||||
 | 
					        cipher_uuid -> Varchar, | 
				
			||||
 | 
					        file_name -> Text, | 
				
			||||
 | 
					        file_size -> Integer, | 
				
			||||
 | 
					        akey -> Nullable<Text>, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    ciphers (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        created_at -> Datetime, | 
				
			||||
 | 
					        updated_at -> Datetime, | 
				
			||||
 | 
					        user_uuid -> Nullable<Varchar>, | 
				
			||||
 | 
					        organization_uuid -> Nullable<Varchar>, | 
				
			||||
 | 
					        atype -> Integer, | 
				
			||||
 | 
					        name -> Text, | 
				
			||||
 | 
					        notes -> Nullable<Text>, | 
				
			||||
 | 
					        fields -> Nullable<Text>, | 
				
			||||
 | 
					        data -> Text, | 
				
			||||
 | 
					        favorite -> Bool, | 
				
			||||
 | 
					        password_history -> Nullable<Text>, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    ciphers_collections (cipher_uuid, collection_uuid) { | 
				
			||||
 | 
					        cipher_uuid -> Varchar, | 
				
			||||
 | 
					        collection_uuid -> Varchar, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    collections (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        org_uuid -> Varchar, | 
				
			||||
 | 
					        name -> Text, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    devices (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        created_at -> Datetime, | 
				
			||||
 | 
					        updated_at -> Datetime, | 
				
			||||
 | 
					        user_uuid -> Varchar, | 
				
			||||
 | 
					        name -> Text, | 
				
			||||
 | 
					        atype -> Integer, | 
				
			||||
 | 
					        push_token -> Nullable<Text>, | 
				
			||||
 | 
					        refresh_token -> Text, | 
				
			||||
 | 
					        twofactor_remember -> Nullable<Text>, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    folders (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        created_at -> Datetime, | 
				
			||||
 | 
					        updated_at -> Datetime, | 
				
			||||
 | 
					        user_uuid -> Varchar, | 
				
			||||
 | 
					        name -> Text, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    folders_ciphers (cipher_uuid, folder_uuid) { | 
				
			||||
 | 
					        cipher_uuid -> Varchar, | 
				
			||||
 | 
					        folder_uuid -> Varchar, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    invitations (email) { | 
				
			||||
 | 
					        email -> Varchar, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    organizations (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        name -> Text, | 
				
			||||
 | 
					        billing_email -> Text, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    twofactor (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        user_uuid -> Varchar, | 
				
			||||
 | 
					        atype -> Integer, | 
				
			||||
 | 
					        enabled -> Bool, | 
				
			||||
 | 
					        data -> Text, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    users (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        created_at -> Datetime, | 
				
			||||
 | 
					        updated_at -> Datetime, | 
				
			||||
 | 
					        email -> Varchar, | 
				
			||||
 | 
					        name -> Text, | 
				
			||||
 | 
					        password_hash -> Blob, | 
				
			||||
 | 
					        salt -> Blob, | 
				
			||||
 | 
					        password_iterations -> Integer, | 
				
			||||
 | 
					        password_hint -> Nullable<Text>, | 
				
			||||
 | 
					        akey -> Text, | 
				
			||||
 | 
					        private_key -> Nullable<Text>, | 
				
			||||
 | 
					        public_key -> Nullable<Text>, | 
				
			||||
 | 
					        totp_secret -> Nullable<Text>, | 
				
			||||
 | 
					        totp_recover -> Nullable<Text>, | 
				
			||||
 | 
					        security_stamp -> Text, | 
				
			||||
 | 
					        equivalent_domains -> Text, | 
				
			||||
 | 
					        excluded_globals -> Text, | 
				
			||||
 | 
					        client_kdf_type -> Integer, | 
				
			||||
 | 
					        client_kdf_iter -> Integer, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    users_collections (user_uuid, collection_uuid) { | 
				
			||||
 | 
					        user_uuid -> Varchar, | 
				
			||||
 | 
					        collection_uuid -> Varchar, | 
				
			||||
 | 
					        read_only -> Bool, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					table! { | 
				
			||||
 | 
					    users_organizations (uuid) { | 
				
			||||
 | 
					        uuid -> Varchar, | 
				
			||||
 | 
					        user_uuid -> Varchar, | 
				
			||||
 | 
					        org_uuid -> Varchar, | 
				
			||||
 | 
					        access_all -> Bool, | 
				
			||||
 | 
					        akey -> Text, | 
				
			||||
 | 
					        status -> Integer, | 
				
			||||
 | 
					        atype -> Integer, | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					joinable!(attachments -> ciphers (cipher_uuid)); | 
				
			||||
 | 
					joinable!(ciphers -> organizations (organization_uuid)); | 
				
			||||
 | 
					joinable!(ciphers -> users (user_uuid)); | 
				
			||||
 | 
					joinable!(ciphers_collections -> ciphers (cipher_uuid)); | 
				
			||||
 | 
					joinable!(ciphers_collections -> collections (collection_uuid)); | 
				
			||||
 | 
					joinable!(collections -> organizations (org_uuid)); | 
				
			||||
 | 
					joinable!(devices -> users (user_uuid)); | 
				
			||||
 | 
					joinable!(folders -> users (user_uuid)); | 
				
			||||
 | 
					joinable!(folders_ciphers -> ciphers (cipher_uuid)); | 
				
			||||
 | 
					joinable!(folders_ciphers -> folders (folder_uuid)); | 
				
			||||
 | 
					joinable!(twofactor -> users (user_uuid)); | 
				
			||||
 | 
					joinable!(users_collections -> collections (collection_uuid)); | 
				
			||||
 | 
					joinable!(users_collections -> users (user_uuid)); | 
				
			||||
 | 
					joinable!(users_organizations -> organizations (org_uuid)); | 
				
			||||
 | 
					joinable!(users_organizations -> users (user_uuid)); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					allow_tables_to_appear_in_same_query!( | 
				
			||||
 | 
					    attachments, | 
				
			||||
 | 
					    ciphers, | 
				
			||||
 | 
					    ciphers_collections, | 
				
			||||
 | 
					    collections, | 
				
			||||
 | 
					    devices, | 
				
			||||
 | 
					    folders, | 
				
			||||
 | 
					    folders_ciphers, | 
				
			||||
 | 
					    invitations, | 
				
			||||
 | 
					    organizations, | 
				
			||||
 | 
					    twofactor, | 
				
			||||
 | 
					    users, | 
				
			||||
 | 
					    users_collections, | 
				
			||||
 | 
					    users_organizations, | 
				
			||||
 | 
					); | 
				
			||||
					Loading…
					
					
				
		Reference in new issue