treasuredb/schema/triggers/x_paidChangedOutsideTrigger...

10 lines
392 B
MySQL
Raw Normal View History

-- Prevent modification of paid value outside triggers which must adjust it exclusively
-- when new transfer records are inserted
2017-02-21 22:24:27 +01:00
CREATE TRIGGER x_paidChangedOutsideTrigger
BEFORE UPDATE OF paid ON Debit
2017-01-22 21:20:17 +01:00
WHEN NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK LIMIT 1)
BEGIN
SELECT RAISE(ABORT, "paid is set and adjusted automatically according to added Transfer records");
END;