-- t-paliad-184 down — reverts the Pipeline-C data-move from
-- 085_pipeline_c_data_move.up.sql. Deletes every paliad.deadline_rules
-- row carrying a non-NULL trigger_event_id (those are exactly the rows
-- the up-migration created — before mig 085 no Pipeline-A rule ever
-- carried trigger_event_id, and Slice 9 hasn't dropped the source
-- table yet so the rows can be regenerated).
--
-- Audit-reason set so the mig 079 trigger captures the rollback
-- rationale and doesn't raise on DELETE.

SELECT set_config(
    'paliad.audit_reason',
    'rollback 085: delete Pipeline-C unified rows (source preserved in event_deadlines)',
    true);

DELETE FROM paliad.deadline_rules
 WHERE trigger_event_id IS NOT NULL;
