mig 134 was inserting code='upc.apl' (2 segments) into paliad.proceeding_types, which carries paliad_proceeding_code_shape CHECK requiring 3 dot-segments OR '^_archived_'. Every container restart hit the constraint, rolled the migration TXN back, and crash-looped paliad.de. Rename the unified Berufung code to 'upc.apl.unified' (3 segments, satisfies the constraint, preserves design intent). The pre-existing constraint is a useful jurisdiction.category.specific invariant — keep it, fix the new row. Touched only string literals: - mig 134 up.sql + down.sql (insert, lookups, post-checks) - frontend/src/verfahrensablauf.tsx (UPC_TYPES code + i18nKey) - frontend/src/client/verfahrensablauf.ts (APPELLANT_AXIS + APPEAL_TARGET sets) - frontend/src/client/i18n.ts (DE + EN translation rows) - frontend/src/i18n-keys.ts (auto-regen via bun build) - internal/services/lookup_events_test.go (anchor-row assertion) Verified: `grep -rn "'upc\.apl'\|\"upc\.apl\""` returns zero hits. go build, bun run build, go test ./... all green.
64 lines
2.4 KiB
SQL
64 lines
2.4 KiB
SQL
-- 134_berufung_unification — DOWN
|
|
--
|
|
-- Reverses the Berufung unification: un-archives the 3 old appeal
|
|
-- proceeding_types, points the 16 rules back at their original
|
|
-- proceeding by their applies_to_target stamp, drops the new
|
|
-- upc.apl row, drops the two columns + their CHECK constraints.
|
|
--
|
|
-- The 3 old proceeding_types are recovered by code (we archived them,
|
|
-- never deleted them — that's what makes this down-migration safe).
|
|
-- ---------------------------------------------------------------
|
|
|
|
-- ---------------------------------------------------------------
|
|
-- 1. Un-archive the 3 old appeal proceeding_types.
|
|
-- ---------------------------------------------------------------
|
|
|
|
UPDATE paliad.proceeding_types
|
|
SET is_active = true,
|
|
updated_at = now()
|
|
WHERE code IN ('upc.apl.merits', 'upc.apl.cost', 'upc.apl.order');
|
|
|
|
-- ---------------------------------------------------------------
|
|
-- 2. Point rules back at their original proceeding_type by stamp.
|
|
-- ---------------------------------------------------------------
|
|
|
|
UPDATE paliad.deadline_rules dr
|
|
SET proceeding_type_id = (
|
|
SELECT id FROM paliad.proceeding_types WHERE code = 'upc.apl.merits'
|
|
)
|
|
WHERE dr.applies_to_target = ARRAY['endentscheidung']::text[];
|
|
|
|
UPDATE paliad.deadline_rules dr
|
|
SET proceeding_type_id = (
|
|
SELECT id FROM paliad.proceeding_types WHERE code = 'upc.apl.cost'
|
|
)
|
|
WHERE dr.applies_to_target = ARRAY['kostenentscheidung']::text[];
|
|
|
|
UPDATE paliad.deadline_rules dr
|
|
SET proceeding_type_id = (
|
|
SELECT id FROM paliad.proceeding_types WHERE code = 'upc.apl.order'
|
|
)
|
|
WHERE dr.applies_to_target = ARRAY['anordnung']::text[];
|
|
|
|
-- ---------------------------------------------------------------
|
|
-- 3. Drop the unified upc.apl.unified row (now orphaned).
|
|
-- ---------------------------------------------------------------
|
|
|
|
DELETE FROM paliad.proceeding_types WHERE code = 'upc.apl.unified';
|
|
|
|
-- ---------------------------------------------------------------
|
|
-- 4. Drop the new columns + their CHECK constraints.
|
|
-- ---------------------------------------------------------------
|
|
|
|
ALTER TABLE paliad.deadline_rules
|
|
DROP CONSTRAINT IF EXISTS deadline_rules_applies_to_target_chk;
|
|
|
|
ALTER TABLE paliad.deadline_rules
|
|
DROP COLUMN IF EXISTS applies_to_target;
|
|
|
|
ALTER TABLE paliad.proceeding_types
|
|
DROP CONSTRAINT IF EXISTS proceeding_types_appeal_target_chk;
|
|
|
|
ALTER TABLE paliad.proceeding_types
|
|
DROP COLUMN IF EXISTS appeal_target;
|