2026-11-11 16:54:49 +00:00
|
|
|
PRAGMA foreign_keys = ON;
|
|
|
|
|
|
2026-11-11 18:30:29 +00:00
|
|
|
-- ids are AUTOINCREMENT: rows can move between entries and records
|
|
|
|
|
-- (archive / unarchive), and ids must never be reused — journal targets
|
|
|
|
|
-- stay meaningful forever.
|
2026-11-11 16:54:49 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS entries (
|
2026-11-11 18:30:29 +00:00
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
2026-11-11 16:54:49 +00:00
|
|
|
ring TEXT NOT NULL CHECK (ring IN ('a', 'b', 'cold')),
|
|
|
|
|
type TEXT NOT NULL CHECK (type IN ('place', 'person', 'fact', 'thread')),
|
|
|
|
|
label TEXT NOT NULL,
|
|
|
|
|
detail TEXT NOT NULL DEFAULT '',
|
|
|
|
|
created TEXT NOT NULL,
|
|
|
|
|
last_touched TEXT NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS entries_ring_touch
|
|
|
|
|
ON entries (ring, last_touched DESC, id DESC);
|
|
|
|
|
|
2026-11-11 18:30:29 +00:00
|
|
|
-- the character's files: cards, ledgers, manifests.
|
|
|
|
|
-- detailed, queryable, never bulk-loaded into context.
|
2026-11-13 23:40:33 +00:00
|
|
|
-- access is diegetic and per-run: settings.json {"records": bool}
|
2026-11-11 18:30:29 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS records (
|
|
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
|
kind TEXT NOT NULL,
|
|
|
|
|
label TEXT NOT NULL,
|
|
|
|
|
detail TEXT NOT NULL DEFAULT '',
|
|
|
|
|
created TEXT NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2026-11-13 23:40:33 +00:00
|
|
|
-- the player's piece of paper: freeform descriptions of her immediate
|
|
|
|
|
-- situation, admitted by the three-part gate (non-normal, acute,
|
|
|
|
|
-- turn-affecting). No keys, no baselines — just what's true right now.
|
|
|
|
|
-- the player mutates it with <lost>/<gained> deltas (exact match);
|
|
|
|
|
-- the GM overrides out-of-band. Descriptions never contain commas:
|
|
|
|
|
-- both the delta lists and the <status> block are comma-separated.
|
|
|
|
|
CREATE TABLE IF NOT EXISTS paper (
|
|
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
|
descr TEXT NOT NULL UNIQUE,
|
|
|
|
|
added TEXT NOT NULL
|
2026-11-11 18:44:58 +00:00
|
|
|
);
|
|
|
|
|
|
2026-11-14 21:15:32 +00:00
|
|
|
-- her agenda: the hot queue of what drives her — intentions, not
|
|
|
|
|
-- states (those live on the paper). Id order IS queue order:
|
|
|
|
|
-- newest-added at the top, the bottom evicted on overflow — a recency
|
|
|
|
|
-- ring buffer for free. The player mutates it with <add>/<drop>
|
|
|
|
|
-- deltas (comma-separated adds, index-based drops); the GM overrides
|
|
|
|
|
-- with agenda-set. Items never contain commas: the add transport is
|
|
|
|
|
-- comma-separated, same as the paper's descriptions.
|
|
|
|
|
CREATE TABLE IF NOT EXISTS agenda (
|
|
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
|
descr TEXT NOT NULL UNIQUE,
|
|
|
|
|
added TEXT NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
2026-11-11 18:30:29 +00:00
|
|
|
-- append-only audit journal; nothing here is ever updated or deleted.
|
2026-11-13 23:40:33 +00:00
|
|
|
-- target is 'e<id>' for entries, 'r<id>' for records, 'p<id>' for paper
|
|
|
|
|
-- rows, 'paper' for whole-paper replaces.
|
|
|
|
|
-- prior captures the replaced state of a journaled mutator (the saga
|
|
|
|
|
-- rule): amend/discard carry the old record content, paper ops carry
|
|
|
|
|
-- what was lost — so turn surgery can compensate mechanically.
|
2026-11-11 16:54:49 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS events (
|
2026-11-11 18:30:29 +00:00
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
2026-11-11 16:54:49 +00:00
|
|
|
window TEXT NOT NULL,
|
2026-11-14 21:15:32 +00:00
|
|
|
op TEXT NOT NULL CHECK (op IN ('insert', 'touch', 'promote', 'demote', 'reword', 'delete', 'evict', 'revive', 'record', 'archive', 'unarchive', 'amend', 'discard', 'paper-add', 'paper-drop', 'paper-set', 'agenda-add', 'agenda-drop', 'agenda-evict', 'agenda-set')),
|
2026-11-11 18:30:29 +00:00
|
|
|
target TEXT NOT NULL,
|
2026-11-13 23:40:33 +00:00
|
|
|
reason TEXT NOT NULL DEFAULT '',
|
|
|
|
|
prior TEXT NOT NULL DEFAULT ''
|
2026-11-11 16:54:49 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS events_window ON events (window);
|