db/cell_history_ddl.ts view source
readonly ["cell_history"] import {CELL_HISTORY_DROP_TABLES} from '@fuzdev/fuz_app/db/cell_history_ddl.js'; Tables created by CELL_HISTORY_MIGRATION_NS, in drop order.
Cell history PG schema (schema only).
Lightweight references to cell state snapshots. Heavy data (serialized
cell bytes) lives in the fact store; fact_hash points there. The
snapshot lifecycle (when to serialize, hash, store, and record) is
deferred to a future iteration — this only stages the table so
downstream code can target a stable schema. The table ships
present-but-unwritten.
fact_hash is intentionally not a foreign key to fact(hash) —
snapshots may be evicted by GC policy while history rows remain as audit
traces, and federation may target facts on another instance.
Depends on CELL_MIGRATION_NS (FK on cell.id).
6 declarations
db/cell_history_ddl.ts view source
readonly ["cell_history"] import {CELL_HISTORY_DROP_TABLES} from '@fuzdev/fuz_app/db/cell_history_ddl.js'; Tables created by CELL_HISTORY_MIGRATION_NS, in drop order.
db/cell_history_ddl.ts view source
string[] import {CELL_HISTORY_INDEXES} from '@fuzdev/fuz_app/db/cell_history_ddl.js'; Cell-history indexes.
idx_cell_history_cell: per-cell timeline reads (newest first).idx_cell_history_fact: fact → cells reverse lookup for GC liveness
and provenance queries.db/cell_history_ddl.ts view source
"fuz_cell_history" import {CELL_HISTORY_MIGRATION_NAMESPACE} from '@fuzdev/fuz_app/db/cell_history_ddl.js'; Namespace identifier for cell-history migrations.
db/cell_history_ddl.ts view source
MigrationNamespace import {CELL_HISTORY_MIGRATION_NS} from '@fuzdev/fuz_app/db/cell_history_ddl.js'; Migration namespace consumed by run_migrations.
db/cell_history_ddl.ts view source
Migration[] import {CELL_HISTORY_MIGRATIONS} from '@fuzdev/fuz_app/db/cell_history_ddl.js'; Cell-history migrations.
db/cell_history_ddl.ts view source
"\nCREATE TABLE IF NOT EXISTS cell_history (\n\tid BIGSERIAL PRIMARY KEY,\n\tcell_id UUID NOT NULL REFERENCES cell(id) ON DELETE CASCADE,\n\tfact_hash TEXT NOT NULL,\n\taction_id UUID,\n\tcreated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n)" import {CELL_HISTORY_SCHEMA} from '@fuzdev/fuz_app/db/cell_history_ddl.js'; cell_history table — append-only log of cell snapshot references.