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