imgboard/migrations/20231018134946_init.sql

26 lines
662 B
SQL

CREATE TABLE users (
id SERIAL PRIMARY KEY,
username TEXT NOT NULL UNIQUE,
password TEXT 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
);