treasuredb/schema/triggers/x_changedDebit.sql
Florian "flowdy" Heß df9c0b4065 Fixed trigger sequence
2017-02-21 22:24:27 +01:00

9 lines
312 B
SQL

CREATE TRIGGER x_changedDebit
BEFORE UPDATE OF debtor, transferCredit, value ON Debit
WHEN EXISTS (SELECT * FROM Transfer WHERE billId=NEW.billId)
AND NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK LIMIT 1)
BEGIN
SELECT RAISE(FAIL, "Debt is involved in transfers to revoke at first");
END;