47 lines
1.4 KiB
MySQL
47 lines
1.4 KiB
MySQL
|
CREATE TABLE users (
|
||
|
username text NOT NULL PRIMARY KEY,
|
||
|
name text COLLATE NOCASE NOT NULL,
|
||
|
mail text COLLATE NOCASE,
|
||
|
password text NOT NULL
|
||
|
);
|
||
|
|
||
|
INSERT INTO users (username, name, mail, password) VALUES (
|
||
|
"admin", "Administrator", "admin@example.com",
|
||
|
"$argon2id$v=19$m=65536,t=4,p=1$WTQ0di44NW11MUJ1b3RMQw$+LRAQRaIXE2jhfavNFNuxnEtEUT6tEBz/98pTtD0EnM"
|
||
|
);
|
||
|
|
||
|
CREATE TABLE auth_tokens (
|
||
|
token text NOT NULL PRIMARY KEY,
|
||
|
username text NOT NULL REFERENCES users(username) ON UPDATE CASCADE ON DELETE CASCADE,
|
||
|
creation_date REAL,
|
||
|
expiration_date REAL
|
||
|
);
|
||
|
|
||
|
CREATE TABLE scases (
|
||
|
uuid text NOT NULL PRIMARY KEY,
|
||
|
username text NOT NULL REFERENCES users(username) ON UPDATE CASCADE ON DELETE CASCADE,
|
||
|
name text NOT NULL,
|
||
|
last_change REAL NOT NULL,
|
||
|
removed INTEGER NOT NULL
|
||
|
FOREIGN KEY(username) REFERENCES artist(artistid)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE categories (
|
||
|
uuid text NOT NULL PRIMARY KEY,
|
||
|
scase_uuid text NOT NULL REFERENCES scases(uuid) ON UPDATE CASCADE ON DELETE CASCADE,
|
||
|
name text NOT NULL,
|
||
|
color text NOT NULL,
|
||
|
last_change REAL NOT NULL,
|
||
|
removed INTEGER NOT NULL
|
||
|
);
|
||
|
|
||
|
CREATE TABLE things (
|
||
|
uuid text NOT NULL PRIMARY KEY,
|
||
|
category_uuid text NOT NULL REFERENCES categories(uuid) ON UPDATE CASCADE ON DELETE CASCADE,
|
||
|
label text NOT NULL,
|
||
|
nb INTEGER NOT NULL,
|
||
|
checked INTEGER NOT NULL,
|
||
|
last_change REAL NOT NULL,
|
||
|
removed INTEGER NOT NULL
|
||
|
);
|