2024-10-20 22:05:20 +00:00
|
|
|
DROP TABLE IF EXISTS users;
|
|
|
|
CREATE TABLE users (
|
|
|
|
id TEXT PRIMARY KEY,
|
2024-11-02 16:37:57 +00:00
|
|
|
handle TEXT NOT NULL UNIQUE,
|
2024-10-20 22:05:20 +00:00
|
|
|
full_name TEXT,
|
2024-11-02 16:37:57 +00:00
|
|
|
email TEXT UNIQUE,
|
2024-10-20 22:05:20 +00:00
|
|
|
website TEXT,
|
|
|
|
picture BLOB,
|
2024-11-08 22:38:54 +00:00
|
|
|
roles TEXT NOT NULL, -- json array of user roles
|
2024-10-20 22:05:20 +00:00
|
|
|
|
|
|
|
status TEXT CHECK(status IN ('Active','Disabled')) NOT NULL DEFAULT 'Disabled',
|
|
|
|
password_hash TEXT,
|
|
|
|
activation_token TEXT,
|
|
|
|
last_login_at DATETIME,
|
|
|
|
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)
|
|
|
|
|
|
|
|
last_used_at DATETIME,
|
|
|
|
created_at DATETIME NOT NULL
|
|
|
|
);
|
|
|
|
|