26 lines
693 B
MySQL
26 lines
693 B
MySQL
|
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)
|
||
|
);
|