mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-27 13:06:20 +02:00
* 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>
19 lines
723 B
SQL
19 lines
723 B
SQL
-- Restore migration 190's transitional constraint without changing data. Keep
|
|
-- the validated strict constraint under its shadow name until the transitional
|
|
-- constraint is installed, so rollback never leaves the table unprotected.
|
|
ALTER TABLE agent_task_queue
|
|
RENAME CONSTRAINT agent_task_queue_accountable_matches_originator
|
|
TO agent_task_queue_accountable_matches_originator_strict;
|
|
|
|
ALTER TABLE agent_task_queue
|
|
ADD CONSTRAINT agent_task_queue_accountable_matches_originator
|
|
CHECK (
|
|
originator_source IS NULL
|
|
OR originator_user_id IS NULL
|
|
OR (
|
|
accountable_user_id IS NOT NULL
|
|
AND accountable_user_id = originator_user_id
|
|
)
|
|
)
|
|
NOT VALID;
|