feat: moved to using db migrations

This commit is contained in:
silver 2025-03-10 20:29:07 +00:00
parent a2341c9d9d
commit c0ba582899
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
2 changed files with 63 additions and 83 deletions

53
db/1_setup.sql Normal file
View file

@ -0,0 +1,53 @@
CREATE TABLE IF NOT EXISTS accounts_wolves (
id_wolves integer PRIMARY KEY,
id_student text,
email text NOT NULL,
expiry text NOT NULL,
name_first text,
name_second text
);
CREATE TABLE IF NOT EXISTS accounts_new (
mail text PRIMARY KEY,
auth_code text NOT NULL,
date_iso text NOT NULL,
date_expiry text NOT NULL,
name_first text NOT NULL,
name_surname text NOT NULL,
id_student text NOT NULL
);
CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_new (auth_code);
CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_new (date_expiry);
CREATE TABLE IF NOT EXISTS accounts_ssh (
user text PRIMARY KEY,
auth_code text NOT NULL,
email text NOT NULL
);
CREATE TABLE IF NOT EXISTS accounts_reset (
user text PRIMARY KEY,
auth_code text NOT NULL,
date_expiry text NOT NULL
);
CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_reset (auth_code);
CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_reset (date_expiry);
CREATE TABLE IF NOT EXISTS accounts (
user text PRIMARY KEY,
uid integer NOT NULL,
mail text NOT NULL,
student_id text NOT NULL,
secure integer NOT NULL
);
CREATE INDEX IF NOT EXISTS index_uid_number ON accounts (uid);
CREATE INDEX IF NOT EXISTS index_mail ON accounts (mail);
CREATE INDEX IF NOT EXISTS index_student_id ON accounts (student_id);