add session creation ts
This commit is contained in:
parent
2097bd1cca
commit
d7a55f6579
3 changed files with 28 additions and 1 deletions
15
src/auth/auth.sql
Normal file
15
src/auth/auth.sql
Normal file
|
@ -0,0 +1,15 @@
|
|||
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,
|
||||
"created" timestamptz NOT NULL DEFAULT NOW(),
|
||||
FOREIGN KEY("user") REFERENCES users(username)
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue