vaultwarden/migrations/mysql/2018-01-14-171611_create_ta.../up.sql

63 lines
1.9 KiB
MySQL
Raw Normal View History

2018-02-09 19:00:55 -05:00
CREATE TABLE users (
2019-05-20 15:12:41 -04:00
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
2019-05-20 15:12:41 -04:00
email VARCHAR(255) NOT NULL UNIQUE,
name TEXT NOT NULL,
password_hash BLOB NOT NULL,
salt BLOB NOT NULL,
password_iterations INTEGER NOT NULL,
2018-02-09 19:00:55 -05:00
password_hint TEXT,
2019-05-26 17:02:41 -04:00
`key` TEXT NOT NULL,
2018-02-09 19:00:55 -05:00
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
2018-02-09 19:00:55 -05:00
);
CREATE TABLE devices (
2019-05-20 15:12:41 -04:00
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
2019-05-20 15:12:41 -04:00
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
name TEXT NOT NULL,
2019-05-26 17:02:41 -04:00
type INTEGER NOT NULL,
push_token TEXT,
refresh_token TEXT NOT NULL
2018-02-09 19:00:55 -05:00
);
CREATE TABLE ciphers (
2019-05-20 15:12:41 -04:00
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
2018-02-09 19:00:55 -05:00
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
2019-05-20 15:12:41 -04:00
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
folder_uuid VARCHAR(40) REFERENCES folders (uuid),
organization_uuid VARCHAR(40),
2019-05-26 17:02:41 -04:00
type INTEGER NOT NULL,
name TEXT NOT NULL,
notes TEXT,
fields TEXT,
2018-02-09 19:00:55 -05:00
data TEXT NOT NULL,
favorite BOOLEAN NOT NULL
);
CREATE TABLE attachments (
2019-05-20 15:12:41 -04:00
id VARCHAR(40) NOT NULL PRIMARY KEY,
cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
file_name TEXT NOT NULL,
file_size INTEGER NOT NULL
2018-02-09 19:00:55 -05:00
);
CREATE TABLE folders (
2019-05-20 15:12:41 -04:00
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
2018-02-09 19:00:55 -05:00
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
2019-05-20 15:12:41 -04:00
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
2018-02-09 19:00:55 -05:00
name TEXT NOT NULL
);
2019-05-20 15:12:41 -04:00