user update

This commit is contained in:
JMARyA 2024-12-27 03:56:27 +01:00
parent d7a55f6579
commit e5fe40e4be
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
8 changed files with 205 additions and 77 deletions

View file

@ -1,4 +1,5 @@
CREATE TYPE user_role AS ENUM ('regular', 'admin');
CREATE TYPE session_kind AS ENUM ('api', 'user');
CREATE TABLE IF NOT EXISTS users (
username VARCHAR(255) NOT NULL PRIMARY KEY,
@ -11,5 +12,13 @@ CREATE TABLE IF NOT EXISTS user_session (
token text NOT NULL,
"user" varchar(255) NOT NULL,
"created" timestamptz NOT NULL DEFAULT NOW(),
"csrf" UUID NOT NULL DEFAULT gen_random_uuid(),
"name" varchar(255)
kind session_kind NOT NULL DEFAULT 'user',
FOREIGN KEY("user") REFERENCES users(username)
);
CREATE TABLE IF NOT EXISTS user_profile_pic (
username VARCHAR(255) NOT NULL PRIMARY KEY,
"image" bytea NOT NULL
);