-- One row per Series that is failing right now (ADR-0016): the row's -- existence is the failure state, failing_since ages the run of failures, -- and a correct read deletes the row. Keyed by the same (site, series_id) -- composite the rest of the system uses, with the cascade so deleting a -- Series takes its failure row and orphan removal stays a single statement. CREATE TABLE poll_failures ( site text NOT NULL, series_id text NOT NULL, outcome text NOT NULL, failing_since bigint NOT NULL, PRIMARY KEY (site, series_id), FOREIGN KEY (site, series_id) REFERENCES series (site, series_id) ON DELETE CASCADE );