2018-02-10 03:00:55 +03:00
|
|
|
CREATE TABLE users (
|
2019-05-27 18:20:20 +03:00
|
|
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
2018-02-15 02:40:34 +03:00
|
|
|
created_at DATETIME NOT NULL,
|
|
|
|
updated_at DATETIME NOT NULL,
|
2019-05-20 22:12:41 +03:00
|
|
|
email VARCHAR(255) NOT NULL UNIQUE,
|
2018-02-15 02:40:34 +03:00
|
|
|
name TEXT NOT NULL,
|
|
|
|
password_hash BLOB NOT NULL,
|
|
|
|
salt BLOB NOT NULL,
|
|
|
|
password_iterations INTEGER NOT NULL,
|
2018-02-10 03:00:55 +03:00
|
|
|
password_hint TEXT,
|
2019-05-27 00:02:41 +03:00
|
|
|
`key` TEXT NOT NULL,
|
2018-02-10 03:00:55 +03:00
|
|
|
private_key TEXT,
|
|
|
|
public_key TEXT,
|
|
|
|
totp_secret TEXT,
|
|
|
|
totp_recover TEXT,
|
2018-02-15 02:40:34 +03:00
|
|
|
security_stamp TEXT NOT NULL,
|
|
|
|
equivalent_domains TEXT NOT NULL,
|
|
|
|
excluded_globals TEXT NOT NULL
|
2018-02-10 03:00:55 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE devices (
|
2019-05-27 18:20:20 +03:00
|
|
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
2018-02-15 02:40:34 +03:00
|
|
|
created_at DATETIME NOT NULL,
|
|
|
|
updated_at DATETIME NOT NULL,
|
2019-05-27 18:20:20 +03:00
|
|
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
2018-02-15 02:40:34 +03:00
|
|
|
name TEXT NOT NULL,
|
2019-05-27 00:02:41 +03:00
|
|
|
type INTEGER NOT NULL,
|
2018-02-15 02:40:34 +03:00
|
|
|
push_token TEXT,
|
|
|
|
refresh_token TEXT NOT NULL
|
2018-02-10 03:00:55 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE ciphers (
|
2019-05-27 18:20:20 +03:00
|
|
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
2018-02-10 03:00:55 +03:00
|
|
|
created_at DATETIME NOT NULL,
|
|
|
|
updated_at DATETIME NOT NULL,
|
2019-05-27 18:20:20 +03:00
|
|
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
|
|
|
folder_uuid CHAR(36) REFERENCES folders (uuid),
|
|
|
|
organization_uuid CHAR(36),
|
2019-05-27 00:02:41 +03:00
|
|
|
type INTEGER NOT NULL,
|
2018-03-06 02:02:36 +03:00
|
|
|
name TEXT NOT NULL,
|
|
|
|
notes TEXT,
|
|
|
|
fields TEXT,
|
2018-02-10 03:00:55 +03:00
|
|
|
data TEXT NOT NULL,
|
2018-02-15 02:40:34 +03:00
|
|
|
favorite BOOLEAN NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE attachments (
|
2019-05-27 18:20:20 +03:00
|
|
|
id CHAR(36) NOT NULL PRIMARY KEY,
|
|
|
|
cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
|
2018-02-15 02:40:34 +03:00
|
|
|
file_name TEXT NOT NULL,
|
|
|
|
file_size INTEGER NOT NULL
|
|
|
|
|
2018-02-10 03:00:55 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE folders (
|
2019-05-27 18:20:20 +03:00
|
|
|
uuid CHAR(36) NOT NULL PRIMARY KEY,
|
2018-02-10 03:00:55 +03:00
|
|
|
created_at DATETIME NOT NULL,
|
|
|
|
updated_at DATETIME NOT NULL,
|
2019-05-27 18:20:20 +03:00
|
|
|
user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
|
2018-02-10 03:00:55 +03:00
|
|
|
name TEXT NOT NULL
|
|
|
|
);
|
2019-05-20 22:12:41 +03:00
|
|
|
|