29 řádky
923 B
SQL
Spustitelný soubor
29 řádky
923 B
SQL
Spustitelný soubor
CREATE TABLE accounts (
|
|
username VARCHAR(32) NOT NULL PRIMARY KEY,
|
|
password VARCHAR(64) NOT NULL,
|
|
owner BOOLEAN NOT NULL DEFAULT false,
|
|
permissions JSONB NOT NULL DEFAULT '0'::jsonb,
|
|
created TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE TABLE boards (
|
|
id VARCHAR(16) NOT NULL PRIMARY KEY,
|
|
name VARCHAR(32) NOT NULL,
|
|
description VARCHAR(128) NOT NULL,
|
|
banners JSONB NOT NULL,
|
|
config JSONB NOT NULL,
|
|
created TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE TABLE bans (
|
|
id SERIAL NOT NULL PRIMARY KEY,
|
|
ip_range INET NOT NULL,
|
|
reason TEXT NOT NULL,
|
|
board VARCHAR(16) DEFAULT NULL REFERENCES boards(id),
|
|
issued_by VARCHAR(32) NOT NULL REFERENCES accounts(username),
|
|
appealable BOOLEAN NOT NULL DEFAULT true,
|
|
appeal TEXT DEFAULT NULL,
|
|
expires TIMESTAMPTZ DEFAULT NULL,
|
|
created TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|