feat: add user and session models
This commit is contained in:
parent
eb0b16ea39
commit
67ad8c2b64
8 changed files with 328 additions and 1 deletions
2
migrations/2025-02-23-095541_auth/down.sql
Normal file
2
migrations/2025-02-23-095541_auth/down.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
drop table sessions;
|
||||
drop table users;
|
||||
13
migrations/2025-02-23-095541_auth/up.sql
Normal file
13
migrations/2025-02-23-095541_auth/up.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
create table users (
|
||||
id bigint primary key not null,
|
||||
username text unique not null,
|
||||
password_hash text not null
|
||||
);
|
||||
|
||||
create table sessions (
|
||||
id bigint primary key not null,
|
||||
user_id bigint not null
|
||||
references users (id)
|
||||
on delete cascade,
|
||||
unique (id, user_id)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue