27 lines
693 B
SQL
27 lines
693 B
SQL
CREATE TABLE users (
|
|
id SERIAL PRIMARY KEY,
|
|
username TEXT NOT NULL UNIQUE,
|
|
password TEXT NOT NULL,
|
|
role INTEGER NOT NULL,
|
|
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
last_active TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE posts (
|
|
id SERIAL PRIMARY KEY,
|
|
tags TEXT NOT NULL DEFAULT '',
|
|
filename TEXT NOT NULL,
|
|
content_type TEXT NOT NULL,
|
|
hash TEXT NOT NULL,
|
|
size INTEGER NOT NULL,
|
|
source TEXT,
|
|
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE tags (
|
|
id SERIAL PRIMARY KEY,
|
|
name TEXT NOT NULL UNIQUE,
|
|
description TEXT NOT NULL
|
|
);
|