Journal

schema.js 3 lines

Files · 9
123// Exact DDL is mirrored in bench/fixtures/apps/com.lattice.journal/schema.sql.
export const DDL =
  "CREATE TABLE IF NOT EXISTS entries (\n  id TEXT PRIMARY KEY, /* UUID */\n  date TEXT NOT NULL UNIQUE, /* device-local YYYY-MM-DD, one entry per date */\n  text TEXT NOT NULL CHECK (length(trim(text)) > 0),\n  mood TEXT NOT NULL DEFAULT 'neutral' CHECK (mood IN ('very-low','low','neutral','good','great')),\n  tags TEXT NOT NULL DEFAULT '[]', /* JSON array of unique, trimmed, case-sensitive tag strings */\n  created_at TEXT NOT NULL, /* UTC ISO 8601, e.g. 2026-10-15T12:00:00.000Z */\n  updated_at TEXT NOT NULL /* UTC ISO 8601 */\n);\nCREATE TABLE IF NOT EXISTS event_outbox (\n  id TEXT PRIMARY KEY, /* stable deduplication key for an outgoing event */\n  name TEXT NOT NULL,\n  payload TEXT NOT NULL, /* JSON object conforming to the manifest event schema */\n  created_at TEXT NOT NULL, /* UTC ISO 8601 */\n  delivered_at TEXT /* UTC ISO 8601, NULL until host accepts event */\n);\nCREATE TABLE IF NOT EXISTS listener_receipts (\n  event_hash TEXT PRIMARY KEY, /* host event hash, scoped by listener name */\n  processed_at TEXT NOT NULL /* UTC ISO 8601 */\n);\n";