textmachine/platform/internal/pgstore/migrations/00012_resync_stamp.sql

18 lines
951 B
SQL

-- +goose Up
-- When this run's figures were last folded in from `tmctl status --json`.
--
-- The resync is a SLOW poll (minutes) of a run that moves continuously, so what it materializes is
-- honestly stale, and by an amount only this stamp names. It matters most exactly where the stream
-- is unavailable — a quarantined attempt, or an engine build with no emitter — because there the
-- projection stops moving between polls and nothing else on the row says how old it is.
--
-- Null means the run has never been resynced, which is the normal state of a run whose journal the
-- platform is tailing: the stream carries its own freshness.
--
-- ⚠ Not on the wire. Contract v0 has no staleness field on a run, so this is readable by an operator
-- and by whatever later pack adds one; see the register row on the deviation.
alter table runs add column last_resync_at timestamptz;
-- +goose Down
alter table runs drop column last_resync_at;