Files
multica/server/migrations/198_agent_task_attribution_strict_constraint_validate.up.sql
Multica Eve d74aed1e07 MUL-4302 Remove legacy attribution invariant exemption (#5504)
* fix(attribution): remove legacy invariant exemption

Co-authored-by: multica-agent <github@multica.ai>

* test(attribution): enforce strict legacy row rejection

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: Eve <eve@multica-ai.local>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-16 11:21:20 +08:00

10 lines
570 B
SQL

-- Validate the strict shadow constraint only after the attribution backfill has
-- completed. This takes a SHARE UPDATE EXCLUSIVE lock while scanning the table,
-- which permits normal INSERT/UPDATE/DELETE traffic to continue.
--
-- Any remaining row where originator_user_id is set but accountable_user_id is
-- NULL or different causes this migration to fail closed. The validated shadow
-- replaces migration 190's transitional constraint in migration 199.
ALTER TABLE agent_task_queue
VALIDATE CONSTRAINT agent_task_queue_accountable_matches_originator_strict;