CREATE TABLE files
(
    id           INT PRIMARY key GENERATED BY DEFAULT AS identity,
    hash         text    NOT NULL,
    originalname text    NOT NULL,
    filename     text    NOT NULL,
    size         integer not null,
    date         integer not null,
    ip           text    null
);

CREATE TABLE blacklist
(
    id           INT PRIMARY key GENERATED BY DEFAULT AS identity,
    hash         text    NOT NULL,
    originalname text    NULL,
    time         integer null,
    ip           text    null
);

CREATE TABLE ratelimit
(
    id     INT PRIMARY key GENERATED BY DEFAULT AS identity,
    iphash text    NOT NULL,
    files  integer not null,
    time   integer not null
);

CREATE TABLE accounts
(
    id    INT PRIMARY key GENERATED BY DEFAULT AS identity,
    email text    NOT NULL,
    pass  text    not null,
    level integer not null
);
CREATE INDEX files_hash_idx ON files (hash);
CREATE INDEX files_name_idx ON files (filename);
CREATE INDEX ratelimit_iphash_idx ON ratelimit (iphash);
CREATE INDEX blacklist_hash_idx ON blacklist (hash);