treasuredb/schema/triggers/enforceZeroSpentAtStart.sql
2017-01-23 19:08:04 +01:00

8 lines
163 B
SQL

CREATE TRIGGER enforceZeroSpentAtStart
BEFORE INSERT ON Credit
BEGIN
SELECT RAISE(FAIL, "credit must be initially unused")
WHERE NEW.spent != 0;
END;