Started writing auth sql schema

This commit is contained in:
Jef Roosens 2021-08-20 14:06:01 +02:00
parent fcd31fd6a8
commit 4ccee64323
Signed by untrusted user: Jef Roosens
GPG key ID: 955C0660072F691F
4 changed files with 27 additions and 5 deletions

View file

@ -0,0 +1 @@
-- This file should undo anything in `up.sql`

View file

@ -0,0 +1,17 @@
-- Users
CREATE TABLE users (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
username varchar(32) UNIQUE NOT NULL,
password text NOT NULL
);
-- Permissions that a user can have
CREATE TABLE permissions (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
user_id uuid REFERENCES users (id) NOT NULL,
name varchar NOT NULL,
UNIQUE (user_id, name)
);