2024-10-20 22:05:20 +00:00
|
|
|
DROP TABLE IF EXISTS users;
|
|
|
|
CREATE TABLE users (
|
2024-12-02 17:39:00 +00:00
|
|
|
id TEXT PRIMARY KEY,
|
|
|
|
handle TEXT NOT NULL UNIQUE,
|
|
|
|
full_name TEXT,
|
|
|
|
email TEXT UNIQUE,
|
|
|
|
website TEXT,
|
|
|
|
roles TEXT NOT NULL, -- json array of user roles
|
2024-12-04 17:25:56 +00:00
|
|
|
avatar_asset_id TEXT,
|
2024-10-20 22:05:20 +00:00
|
|
|
|
2024-12-02 17:39:00 +00:00
|
|
|
status TEXT CHECK(status IN ('Invited', 'Active', 'Disabled')) NOT NULL DEFAULT 'Disabled',
|
|
|
|
password_hash TEXT,
|
|
|
|
reset_password_token TEXT,
|
|
|
|
last_login_at DATETIME,
|
|
|
|
created_at DATETIME NOT NULL
|
2024-10-20 22:05:20 +00:00
|
|
|
);
|
2024-11-08 22:38:54 +00:00
|
|
|
|
2024-12-04 17:25:56 +00:00
|
|
|
DROP TABLE IF EXISTS user_assets;
|
|
|
|
CREATE TABLE user_assets (
|
|
|
|
id TEXT PRIMARY KEY,
|
|
|
|
user_id TEXT NOT NULL,
|
|
|
|
mime_type TEXT NOT NULL,
|
|
|
|
fingerprint TEXT NOT NULL,
|
|
|
|
name TEXT, -- file name
|
|
|
|
content BLOB NOT NULL,
|
|
|
|
created_at DATETIME NOT NULL
|
|
|
|
);
|
|
|
|
|
2024-11-08 22:38:54 +00:00
|
|
|
DROP TABLE IF EXISTS authorizations;
|
|
|
|
CREATE TABLE authorizations (
|
|
|
|
id TEXT PRIMARY KEY,
|
|
|
|
user_id TEXT NOT NULL,
|
|
|
|
client_id TEXT NOT NULL,
|
|
|
|
scopes TEXT, -- json array of app scope (permissions)
|
2024-11-09 18:57:15 +00:00
|
|
|
code TEXT,
|
2024-11-08 22:38:54 +00:00
|
|
|
|
|
|
|
last_used_at DATETIME,
|
|
|
|
created_at DATETIME NOT NULL
|
|
|
|
);
|
|
|
|
|