2024-03-11 12:39:52 +00:00
|
|
|
CREATE TABLE users
|
2023-09-06 22:20:09 +01:00
|
|
|
(
|
|
|
|
subject TEXT PRIMARY KEY UNIQUE NOT NULL,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
username TEXT UNIQUE NOT NULL,
|
|
|
|
password TEXT NOT NULL,
|
2024-03-11 12:39:52 +00:00
|
|
|
picture TEXT DEFAULT '' NOT NULL,
|
|
|
|
website TEXT DEFAULT '' NOT NULL,
|
2023-09-06 22:20:09 +01:00
|
|
|
email TEXT NOT NULL,
|
2024-03-11 12:39:52 +00:00
|
|
|
email_verified BOOLEAN DEFAULT 0 NOT NULL,
|
|
|
|
pronouns TEXT DEFAULT 'they/them' NOT NULL,
|
2023-09-06 22:20:09 +01:00
|
|
|
birthdate DATE,
|
2024-03-11 12:39:52 +00:00
|
|
|
zoneinfo TEXT DEFAULT 'UTC' NOT NULL,
|
|
|
|
locale TEXT DEFAULT 'en-US' NOT NULL,
|
2023-09-15 13:06:31 +01:00
|
|
|
role INTEGER DEFAULT 0 NOT NULL,
|
2024-03-11 12:39:52 +00:00
|
|
|
updated_at DATETIME NOT NULL,
|
|
|
|
registered DATETIME NOT NULL,
|
|
|
|
active BOOLEAN DEFAULT 1 NOT NULL
|
2023-09-06 22:20:09 +01:00
|
|
|
);
|
|
|
|
|
2024-03-11 12:39:52 +00:00
|
|
|
CREATE UNIQUE INDEX username_index ON users (username);
|
2023-09-09 01:38:10 +01:00
|
|
|
|
2024-03-11 12:39:52 +00:00
|
|
|
CREATE TABLE client_store
|
2023-09-06 22:20:09 +01:00
|
|
|
(
|
|
|
|
subject TEXT PRIMARY KEY UNIQUE NOT NULL,
|
2023-09-15 13:06:31 +01:00
|
|
|
name TEXT NOT NULL,
|
2023-09-06 22:20:09 +01:00
|
|
|
secret TEXT UNIQUE NOT NULL,
|
|
|
|
domain TEXT NOT NULL,
|
2023-09-15 13:06:31 +01:00
|
|
|
owner TEXT NOT NULL,
|
2024-03-11 12:39:52 +00:00
|
|
|
public BOOLEAN NOT NULL,
|
|
|
|
sso BOOLEAN NOT NULL,
|
|
|
|
active BOOLEAN DEFAULT 1 NOT NULL,
|
2023-09-15 13:06:31 +01:00
|
|
|
FOREIGN KEY (owner) REFERENCES users (subject)
|
2023-09-06 22:20:09 +01:00
|
|
|
);
|
2023-09-09 01:38:10 +01:00
|
|
|
|
2024-03-11 12:39:52 +00:00
|
|
|
CREATE TABLE otp
|
2023-09-09 01:38:10 +01:00
|
|
|
(
|
|
|
|
subject TEXT PRIMARY KEY UNIQUE NOT NULL,
|
2023-10-16 16:47:18 +01:00
|
|
|
secret TEXT NOT NULL,
|
|
|
|
digits INTEGER NOT NULL,
|
2023-09-09 01:38:10 +01:00
|
|
|
FOREIGN KEY (subject) REFERENCES users (subject)
|
|
|
|
);
|