treasuredb/schema/triggers/x_changedCredit.sql
Florian "flowdy" Heß 5299966837 Changed FAIL -> ABORT trigger exceptions
With FAIL, triggers choke but leave the changes in despite. We need to have the current statement undone, however.
2017-02-22 21:58:47 +01:00

9 lines
294 B
SQL

CREATE TRIGGER x_changedCredit
BEFORE UPDATE OF account, value ON Credit
WHEN EXISTS (SELECT * FROM Transfer WHERE credId=NEW.credId)
AND NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK)
BEGIN
SELECT RAISE(ABORT, "Credit involved in transactions to revoke at first");
END;