Files
rustpad/migrations/0005_published_pages.sql
T
2026-07-20 15:59:15 +02:00

9 lines
393 B
SQL

CREATE TABLE published_pages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
token TEXT NOT NULL UNIQUE,
pad_id INTEGER UNIQUE REFERENCES pads(id) ON DELETE CASCADE,
note_id INTEGER UNIQUE REFERENCES notes(id) ON DELETE CASCADE,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
CHECK ((pad_id IS NOT NULL AND note_id IS NULL) OR (pad_id IS NULL AND note_id IS NOT NULL))
);