blogdb/db/main/migrations/20241013202105_init.sql

28 lines
578 B
SQL

CREATE TABLE IF NOT EXISTS users (
name VARCHAR(255) UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
about TEXT,
home TEXT
);
CREATE TABLE IF NOT EXISTS assets (
slug TEXT UNIQUE NOT NULL,
mime TEXT NOT NULL,
data BLOB NOT NULL
);
CREATE TABLE IF NOT EXISTS posts (
id TEXT PRIMARY KEY DEFAULT (lower(hex (randomblob (16)))),
title VARCHAR(255) NOT NULL,
date TEXT,
tags TEXT,
content TEXT
);
CREATE TABLE IF NOT EXISTS drafts (
id TEXT PRIMARY KEY DEFAULT (lower(hex (randomblob (16)))),
title VARCHAR(255) NOT NULL,
tags TEXT,
content TEXT
);