-- Reverting narrows the vocabulary, so rows that used the seventh value are -- folded back into ToolFailure FIRST — the classification they would have had -- before 000016 — or the narrower CHECK cannot be re-added at all. This loses -- the distinction the up migration introduced, which is what reverting means. UPDATE agent_runs SET termination = 'ToolFailure' WHERE termination = 'GatewayFailure'; ALTER TABLE agent_runs DROP CONSTRAINT agent_runs_termination_check; ALTER TABLE agent_runs ADD CONSTRAINT agent_runs_termination_check CHECK (termination IN ( 'Completed', 'BudgetExceeded', 'Deadline', 'ConfirmationPending', 'ToolFailure', 'Refused' ));