feat(t-paliad-182): mig 080 — projects.instance_level

Phase 3 Slice 1, design §2.7 + §7. Adds a nullable text column
gated by a CHECK to 'first' | 'appeal' | 'cassation'. Combined
with proceeding_code + jurisdiction, the FristenrechnerService
(Slice 8) will derive the effective proceeding code — e.g.
DE_INF + appeal → DE_INF_OLG.

No backfill in this slice. The project-detail picker UI (Slice 8)
writes the column; pre-Slice-1 rows stay NULL and behave as
implicit 'first' in the calculator's fallback.
This commit is contained in:
mAi
2026-05-15 00:19:37 +02:00
parent ec0ec32271
commit bd8ec42b80
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
-- t-paliad-182 down — reverses 080_projects_instance_level.up.sql.
ALTER TABLE paliad.projects DROP COLUMN IF EXISTS instance_level;

View File

@@ -0,0 +1,30 @@
-- t-paliad-182 / Fristen Phase 3 Slice 1 — paliad.projects.instance_level
-- (design §2.7, §7).
--
-- Lets the SmartTimeline + calculator derive the effective proceeding
-- code from (proceeding_code, instance_level) — e.g. DE_INF + 'appeal'
-- resolves to DE_INF_OLG.
--
-- Nullable: NULL means "not asked / not relevant" (e.g. EP_GRANT, a
-- non-litigation patent project). Allowed values:
-- first — first instance (default once the picker UI lands)
-- appeal — Berufung / EPA Beschwerde / appellate level
-- cassation — BGH-Revision / EPA-EBA / final instance
--
-- No backfill in this slice. The picker UI (Slice 8) writes the column;
-- legacy projects stay NULL and behave as if first instance via the
-- calculator's fallback (`NULL OR 'first'` → use base proceeding code).
--
-- Idempotent: re-applying is a no-op. Tracker advances 79 → 80.
ALTER TABLE paliad.projects
ADD COLUMN IF NOT EXISTS instance_level text
CHECK (instance_level IS NULL
OR instance_level IN ('first', 'appeal', 'cassation'));
COMMENT ON COLUMN paliad.projects.instance_level IS
'Procedural instance the project sits at: first | appeal | '
'cassation. NULL = unset / not applicable. Combined with '
'proceeding_type.code + jurisdiction by FristenrechnerService to '
'pick the effective proceeding code (e.g. DE_INF + appeal → '
'DE_INF_OLG). See design-fristen-phase2-2026-05-15.md §2.7, §7.';