-- 152_dedupe_identical_sequencing_rule_clones (down) — t-paliad-321
--
-- Best-effort revert from paliad.sequencing_rules_pre_152. Flips the
-- archived rows back to is_active=true / lifecycle_state='published'.
-- Does NOT undo the deadlines.sequencing_rule_id reparent — that would
-- require remembering the previous pointer per row, which the snapshot
-- on sequencing_rules doesn't carry. In live data the reparent was a
-- no-op (zero deadlines pointed at duplicates), so this is fine.

UPDATE paliad.sequencing_rules sr
   SET is_active = true,
       lifecycle_state = 'published',
       updated_at = now()
  FROM paliad.sequencing_rules_pre_152 snap
 WHERE sr.id = snap.id;

DROP TABLE IF EXISTS paliad.sequencing_rules_pre_152;
