Mig 099 (drop_with_po_flag) crash-looped paliad.de prod immediately after deploy: the mig 079 trigger on paliad.deadline_rules raises EXCEPTION 'audit reason required' on UPDATE when paliad.audit_reason is unset. Original file (fermi, t-paliad-207) only had the UPDATE, no set_config wrapper. Patch: prepend the standard 'SELECT set_config(paliad.audit_reason, ...)' at the top so the trigger sees the reason. Same shape as every other migration that mutates deadline_rules. Manual recovery already applied via head MCP — UPDATE'd the 2 rows with audit_reason set, marked tracker version=99 dirty=false, force-restarted the container which booted clean. This commit aligns the in-repo file with the recovered prod state. Idempotent: the WHERE clause matches only rows that still carry with_po, so re-apply is a no-op.
35 lines
1.6 KiB
SQL
35 lines
1.6 KiB
SQL
-- t-paliad-207 — drop the `with_po` flag from the two RoP 19 rules.
|
|
-- m's call 2026-05-18 (interactive session): the Einspruch (R. 19) is
|
|
-- not flag-gated — it's just an optional submission the defendant can
|
|
-- always make, triggered by the SoC. Same reasoning that drove the
|
|
-- always-fire decision for the appeal-spawn rules in t-paliad-203 F2.3
|
|
-- ("appeal is always a possibility").
|
|
--
|
|
-- Net effect: the calculator will surface the R.19 row on every UPC_INF
|
|
-- / UPC_REV calc as an optional row (priority='optional' already set
|
|
-- by mig 095, unchanged here). The save-modal pre-uncheck behaviour
|
|
-- for optional priority handles the "user opts in" gesture without a
|
|
-- separate flag.
|
|
--
|
|
-- Two rows updated; pinned by proceeding code so this stays correct
|
|
-- after any rule-id reshuffle. Idempotent: the WHERE clause matches
|
|
-- the live shape, so re-apply is a no-op.
|
|
--
|
|
-- audit_reason set_config required at the top — the mig 079 trigger
|
|
-- on paliad.deadline_rules raises EXCEPTION 'audit reason required'
|
|
-- on any UPDATE without it. Original mig 099 author missed this and
|
|
-- crash-looped paliad prod; this is the recovery patch.
|
|
|
|
SELECT set_config(
|
|
'paliad.audit_reason',
|
|
'mig 099: drop with_po condition_expr on the two RoP.019.1 rows — m''s call 2026-05-18 (t-paliad-207 interactive session), R.19 Einspruch is always-available not flag-gated',
|
|
true);
|
|
|
|
UPDATE paliad.deadline_rules dr
|
|
SET condition_expr = NULL
|
|
FROM paliad.proceeding_types pt
|
|
WHERE dr.proceeding_type_id = pt.id
|
|
AND pt.code IN ('upc.inf.cfi', 'upc.rev.cfi')
|
|
AND dr.rule_code = 'RoP.019.1'
|
|
AND dr.condition_expr::text LIKE '%with_po%';
|