minauthator/migrations/all.sql

30 lines
938 B
MySQL
Raw Permalink Normal View History

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,
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
);
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)
code TEXT,
last_used_at DATETIME,
created_at DATETIME NOT NULL
);