reference-implementation-architecture — port-explore-timeline-server-foundation delta
The reference records storage SHALL carry a semantictime column on the records table on both the SQLite and Postgres backends, declared TEXT NOT NULL DEFAULT ''. The column SHALL be added on a pre-existing, possibly non-empty records table by an idempotent migration that performs no bulk UPDATE of existing rows: on SQLite via a guarded ALTER TABLE records ADD COLUMN semantictime TEXT NOT NULL DEFAULT '' (guarded by a hasTableColumn check), and on Postgres via ALTER TABLE records ADD COLUMN IF NOT EXISTS semantictime TEXT NOT NULL DEFAULT ''. Existing rows SHALL retain '' and SHALL be read through COALESCE(NULLIF(semantictime, ''), emittedat), so a row without a real semantic value falls back to its emittedat and is never mis-attributed. New and re-emitted rows SHALL receive a real semantictime at write time via the record upsert (ON CONFLICT ... DO UPDATE SET semantictime = excluded.semantic_time). Re-running the migration SHALL be a no-op on both backends.
reference-implementation-architecture