feat: added users db, login, register, logout
This commit is contained in:
1
sql/base.sql
Normal file
1
sql/base.sql
Normal file
@@ -0,0 +1 @@
|
||||
CREATE DATABASE aistuff;
|
||||
22
sql/user.sql
Normal file
22
sql/user.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- drop table if exists tokens;
|
||||
-- drop table if exists users;
|
||||
create table if not exists users (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
user_type integer default 0,
|
||||
username varchar (120) not null,
|
||||
email varchar (120) not null,
|
||||
salt char (8) not null,
|
||||
password char (60) not null,
|
||||
created_on timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
lastlogin_at timestamp default current_timestamp
|
||||
);
|
||||
|
||||
--drop table if exists tokens;
|
||||
create table if not exists tokens (
|
||||
token varchar (120) primary key,
|
||||
user_id uuid references users (id) on delete cascade,
|
||||
time_to_live integer default 86400,
|
||||
emit_day timestamp default current_timestamp
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user