db/cell_history_ddl.ts

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).

view source

Declarations
#

6 declarations

CELL_HISTORY_DROP_TABLES
#

CELL_HISTORY_INDEXES
#

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.

CELL_HISTORY_MIGRATION_NAMESPACE
#

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.

CELL_HISTORY_MIGRATION_NS
#

CELL_HISTORY_MIGRATIONS
#

CELL_HISTORY_SCHEMA
#

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.

Depends on
#