openvibers/openvibe.finance migrations0005_category_from_agent.sql

0005_category_from_agent.sql

main 668 B · 9 lines · sql

1-- phase: expand
2-- A category an agent set (plan §L.2: "every category says whether it came from the provider, you, a rule or AI"):
3-- category_from 'ai', written only through /mcp by something the person allowed to write (a delegated token with a
4-- write grant in OpenVibe Finance). It never overwrites one the person set themselves ('you'). Older code never writes
5-- it and reads it as any other origin.
6ALTER TABLE finance_transactions DROP CONSTRAINT IF EXISTS finance_transactions_category_from_check;
7ALTER TABLE finance_transactions ADD CONSTRAINT finance_transactions_category_from_check
8 CHECK (category_from IN ('none', 'you', 'rule', 'file', 'ai'));
9