2023-09-19 13:39:59 +01:00
|
|
|
-- drop table if exists tokens;
|
2023-09-22 19:22:36 +01:00
|
|
|
|
|
|
|
-- drop table if exists model_data_point;
|
|
|
|
-- drop table if exists model_defenitions;
|
2023-09-21 15:38:02 +01:00
|
|
|
-- drop table if exists models;
|
2023-09-22 19:22:36 +01:00
|
|
|
|
2023-09-19 13:39:59 +01:00
|
|
|
-- drop table if exists users;
|
|
|
|
create table if not exists users (
|
|
|
|
id uuid primary key default gen_random_uuid(),
|
2023-09-21 15:38:02 +01:00
|
|
|
user_type integer default 1,
|
2023-09-19 13:39:59 +01:00
|
|
|
username varchar (120) not null,
|
|
|
|
email varchar (120) not null,
|
|
|
|
salt char (8) not null,
|
2024-04-13 16:59:08 +01:00
|
|
|
password char (60) not null,
|
2023-09-19 13:39:59 +01:00
|
|
|
created_on timestamp default current_timestamp,
|
|
|
|
updated_at timestamp default current_timestamp,
|
|
|
|
lastlogin_at timestamp default current_timestamp
|
|
|
|
);
|
2024-04-13 16:59:08 +01:00
|
|
|
|
2023-09-19 13:39:59 +01:00
|
|
|
--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,
|
2024-04-13 16:59:08 +01:00
|
|
|
name text default '',
|
2023-09-19 13:39:59 +01:00
|
|
|
emit_day timestamp default current_timestamp
|
|
|
|
);
|