init
This commit is contained in:
commit
49b24e5773
22 changed files with 1499 additions and 0 deletions
33
db/migrations/1692914919-init.sql
Normal file
33
db/migrations/1692914919-init.sql
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- +migrate Up
|
||||
|
||||
create table users (
|
||||
id integer primary key,
|
||||
username text not null unique,
|
||||
password text not null,
|
||||
is_admin boolean not null default false
|
||||
);
|
||||
|
||||
create table tokens (
|
||||
id integer primary key,
|
||||
user_id integer not null references users (id) on delete cascade,
|
||||
token text not null unique
|
||||
);
|
||||
|
||||
create table files (
|
||||
id text primary key, -- uuid
|
||||
user_id integer not null references users (id) on delete cascade,
|
||||
filename text not null,
|
||||
content_type text not null,
|
||||
hash text not null,
|
||||
size integer not null,
|
||||
created_at integer not null,
|
||||
expires integer,
|
||||
|
||||
unique(filename, hash)
|
||||
);
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
drop table files;
|
||||
drop table tokens;
|
||||
drop table users;
|
Loading…
Add table
Add a link
Reference in a new issue