flabk/migrate/1662887862_schema.up.sql

19 lines
468 B
MySQL
Raw Normal View History

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
2022-09-11 16:52:37 +01:00
CREATE TABLE users (
id CHAR(22) NOT NULL PRIMARY KEY,
username TEXT NOT NULL,
host TEXT,
display_name TEXT,
password_hash TEXT NOT NULL
2022-09-11 16:52:37 +01:00
);
CREATE UNIQUE INDEX u_username_host ON users (username, host);
CREATE UNIQUE INDEX u_username_local ON users (username) WHERE host IS NULL;
--id UUID NOT NULL PRIMARY KEY DEFAULT uuid_generate_v4(),
CREATE TABLE keys (
key TEXT NOT NULL PRIMARY KEY,
value TEXT NOT NULL
);