-- 0020_hosts_repo_status.sql -- -- NS-03: surface repo init / probe state on the host row so the -- operator sees credential / connectivity failures eagerly rather -- than discovering them via a missed scheduled backup. -- -- repo_status: -- 'unknown' — no probe outcome yet (default for fresh enrolment -- and for hosts re-binding fresh creds). -- 'ready' — last init / probe succeeded; repo is reachable -- with the bound creds. -- 'init_failed' — last init / probe failed; repo_status_error has -- the trimmed agent-side error message. -- -- The init-pending intermediate state is intentionally omitted: a job -- in flight is already visible on the host detail page via -- jobs.status, and bridging both surfaces leads to drift. The host -- column reflects the *outcome* of the last probe. ALTER TABLE hosts ADD COLUMN repo_status TEXT NOT NULL DEFAULT 'unknown' CHECK (repo_status IN ('unknown', 'ready', 'init_failed')); ALTER TABLE hosts ADD COLUMN repo_status_error TEXT NOT NULL DEFAULT '';