Migration 077 adds paliad.projects.counterclaim_of (nullable FK ON DELETE SET NULL) plus a partial index. A trigger function rejects two-level CCR chains: a project with counterclaim_of NOT NULL cannot be the target of another CCR — UPC practice has no CCR-of-a-CCR shape, so reject it at the schema level rather than defending in the application layer. ProjectService gains LoadCounterclaimChildrenVisible (list visible CCR sub-projects against a parent) and CreateCounterclaim (atomic: project row + creator-as-lead team membership + audit rows on parent AND child). The CCR child is placed as a sibling under the same patent (§4.4), our side flips claimant↔defendant by default with a "Stimmt nicht?" override for the R.49.2.b CCI edge case, and the proceeding type defaults to UPC_REV. Title auto-suggests from the patent ancestor's patent_number when available. Tracker advances 76 → 77.
10 lines
318 B
SQL
10 lines
318 B
SQL
-- t-paliad-174 — revert SmartTimeline Slice 3 schema.
|
|
|
|
DROP TRIGGER IF EXISTS projects_no_two_level_ccr ON paliad.projects;
|
|
DROP FUNCTION IF EXISTS paliad.projects_no_two_level_ccr();
|
|
|
|
DROP INDEX IF EXISTS paliad.projects_counterclaim_of_idx;
|
|
|
|
ALTER TABLE paliad.projects
|
|
DROP COLUMN IF EXISTS counterclaim_of;
|