user char(36) for uuid columns
This commit is contained in:
parent
4c9cc9890c
commit
6c38026ef5
|
@ -1,5 +1,5 @@
|
||||||
CREATE TABLE users (
|
CREATE TABLE users (
|
||||||
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
created_at DATETIME NOT NULL,
|
created_at DATETIME NOT NULL,
|
||||||
updated_at DATETIME NOT NULL,
|
updated_at DATETIME NOT NULL,
|
||||||
email VARCHAR(255) NOT NULL UNIQUE,
|
email VARCHAR(255) NOT NULL UNIQUE,
|
||||||
|
@ -19,10 +19,10 @@ CREATE TABLE users (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE devices (
|
CREATE TABLE devices (
|
||||||
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
created_at DATETIME NOT NULL,
|
created_at DATETIME NOT NULL,
|
||||||
updated_at DATETIME NOT NULL,
|
updated_at DATETIME NOT NULL,
|
||||||
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
type INTEGER NOT NULL,
|
type INTEGER NOT NULL,
|
||||||
push_token TEXT,
|
push_token TEXT,
|
||||||
|
@ -30,12 +30,12 @@ CREATE TABLE devices (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE ciphers (
|
CREATE TABLE ciphers (
|
||||||
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
created_at DATETIME NOT NULL,
|
created_at DATETIME NOT NULL,
|
||||||
updated_at DATETIME NOT NULL,
|
updated_at DATETIME NOT NULL,
|
||||||
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
||||||
folder_uuid VARCHAR(40) REFERENCES folders (uuid),
|
folder_uuid CHAR(36) REFERENCES folders (uuid),
|
||||||
organization_uuid VARCHAR(40),
|
organization_uuid CHAR(36),
|
||||||
type INTEGER NOT NULL,
|
type INTEGER NOT NULL,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
notes TEXT,
|
notes TEXT,
|
||||||
|
@ -45,18 +45,18 @@ CREATE TABLE ciphers (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE attachments (
|
CREATE TABLE attachments (
|
||||||
id VARCHAR(40) NOT NULL PRIMARY KEY,
|
id CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
|
cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
|
||||||
file_name TEXT NOT NULL,
|
file_name TEXT NOT NULL,
|
||||||
file_size INTEGER NOT NULL
|
file_size INTEGER NOT NULL
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE folders (
|
CREATE TABLE folders (
|
||||||
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
created_at DATETIME NOT NULL,
|
created_at DATETIME NOT NULL,
|
||||||
updated_at DATETIME NOT NULL,
|
updated_at DATETIME NOT NULL,
|
||||||
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
||||||
name TEXT NOT NULL
|
name TEXT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,15 @@ CREATE TABLE organizations (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE users_collections (
|
CREATE TABLE users_collections (
|
||||||
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
||||||
collection_uuid VARCHAR(40) NOT NULL REFERENCES collections (uuid),
|
collection_uuid CHAR(36) NOT NULL REFERENCES collections (uuid),
|
||||||
PRIMARY KEY (user_uuid, collection_uuid)
|
PRIMARY KEY (user_uuid, collection_uuid)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE users_organizations (
|
CREATE TABLE users_organizations (
|
||||||
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
||||||
org_uuid VARCHAR(40) NOT NULL REFERENCES organizations (uuid),
|
org_uuid CHAR(36) NOT NULL REFERENCES organizations (uuid),
|
||||||
|
|
||||||
access_all BOOLEAN NOT NULL,
|
access_all BOOLEAN NOT NULL,
|
||||||
`key` TEXT NOT NULL,
|
`key` TEXT NOT NULL,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
ALTER TABLE ciphers RENAME TO oldCiphers;
|
ALTER TABLE ciphers RENAME TO oldCiphers;
|
||||||
|
|
||||||
CREATE TABLE ciphers (
|
CREATE TABLE ciphers (
|
||||||
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
created_at DATETIME NOT NULL,
|
created_at DATETIME NOT NULL,
|
||||||
updated_at DATETIME NOT NULL,
|
updated_at DATETIME NOT NULL,
|
||||||
user_uuid VARCHAR(40) REFERENCES users (uuid), -- Make this optional
|
user_uuid CHAR(36) REFERENCES users (uuid), -- Make this optional
|
||||||
organization_uuid VARCHAR(40) REFERENCES organizations (uuid), -- Add reference to orgs table
|
organization_uuid CHAR(36) REFERENCES organizations (uuid), -- Add reference to orgs table
|
||||||
-- Remove folder_uuid
|
-- Remove folder_uuid
|
||||||
type INTEGER NOT NULL,
|
type INTEGER NOT NULL,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
|
@ -16,8 +16,8 @@ CREATE TABLE ciphers (
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE folders_ciphers (
|
CREATE TABLE folders_ciphers (
|
||||||
cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
|
cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
|
||||||
folder_uuid VARCHAR(40) NOT NULL REFERENCES folders (uuid),
|
folder_uuid CHAR(36) NOT NULL REFERENCES folders (uuid),
|
||||||
|
|
||||||
PRIMARY KEY (cipher_uuid, folder_uuid)
|
PRIMARY KEY (cipher_uuid, folder_uuid)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CREATE TABLE ciphers_collections (
|
CREATE TABLE ciphers_collections (
|
||||||
cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
|
cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
|
||||||
collection_uuid VARCHAR(40) NOT NULL REFERENCES collections (uuid),
|
collection_uuid CHAR(36) NOT NULL REFERENCES collections (uuid),
|
||||||
PRIMARY KEY (cipher_uuid, collection_uuid)
|
PRIMARY KEY (cipher_uuid, collection_uuid)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
ALTER TABLE attachments RENAME TO oldAttachments;
|
ALTER TABLE attachments RENAME TO oldAttachments;
|
||||||
|
|
||||||
CREATE TABLE attachments (
|
CREATE TABLE attachments (
|
||||||
id VARCHAR(40) NOT NULL PRIMARY KEY,
|
id CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
|
cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
|
||||||
file_name TEXT NOT NULL,
|
file_name TEXT NOT NULL,
|
||||||
file_size INTEGER NOT NULL
|
file_size INTEGER NOT NULL
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
CREATE TABLE twofactor (
|
CREATE TABLE twofactor (
|
||||||
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
||||||
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
||||||
type INTEGER NOT NULL,
|
type INTEGER NOT NULL,
|
||||||
enabled BOOLEAN NOT NULL,
|
enabled BOOLEAN NOT NULL,
|
||||||
data TEXT NOT NULL,
|
data TEXT NOT NULL,
|
||||||
|
|
Loading…
Reference in New Issue