forked from Chewing_Bever/rusty-bever
Started writing auth sql schema
This commit is contained in:
parent
fcd31fd6a8
commit
4ccee64323
4 changed files with 27 additions and 5 deletions
1
migrations/2021-08-20-110251_users-and-auth/down.sql
Normal file
1
migrations/2021-08-20-110251_users-and-auth/down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
-- This file should undo anything in `up.sql`
|
||||
17
migrations/2021-08-20-110251_users-and-auth/up.sql
Normal file
17
migrations/2021-08-20-110251_users-and-auth/up.sql
Normal 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)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue