foxfiles/db/migration.sql
2024-02-01 21:32:10 +01:00

19 lines
553 B
SQL

CREATE TABLE users (
id INTEGER PRIMARY KEY,
username TEXT UNIQUE NOT NULL,
password TEXT NOT NULL,
salt TEXT NOT NULL
role TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (datetime()),
created_at TEXT NOT NULL DEFAULT (datetime())
);
CREATE TABLE files (
id INTEGER PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
filename TEXT NOT NULL,
hash TEXT NOT NULL UNIQUE,
content_type TEXT NOT NULL,
size INTEGER NOT NULL
);