implement user auth
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
JMARyA 2024-12-16 21:16:02 +01:00
parent b98beff824
commit ae36928791
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
11 changed files with 410 additions and 15 deletions

View file

@ -0,0 +1,14 @@
CREATE TYPE user_role AS ENUM ('regular', 'admin');
CREATE TABLE IF NOT EXISTS users (
username VARCHAR(255) NOT NULL PRIMARY KEY,
"password" text NOT NULL,
user_role user_role NOT NULL DEFAULT 'regular'
);
CREATE TABLE IF NOT EXISTS user_session (
id UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
token text NOT NULL,
"user" varchar(255) NOT NULL,
FOREIGN KEY("user") REFERENCES users(username)
);