treasuredb/schema/triggers/enforceZeroPaidAtStart.sql

8 lines
158 B
MySQL
Raw Normal View History

CREATE TRIGGER enforceZeroPaidAtStart
BEFORE INSERT ON Debit
BEGIN
SELECT RAISE(FAIL, "Debt must be initially unpaid")
WHERE NEW.paid <> 0;
END;