imgboard/migrations/20231018134946_init.sql
2023-10-18 17:17:53 +02:00

27 lines
692 B
SQL

-- Add migration script here
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,
);