treasuredb/schema/triggers/enforceImmutableTransfer.sql

9 lines
277 B
MySQL
Raw Normal View History

CREATE TRIGGER enforceImmutableTransfer
BEFORE UPDATE ON Transfer
WHEN OLD.amount IS NOT NULL
2017-01-22 21:20:17 +01:00
AND NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK)
BEGIN
SELECT RAISE(FAIL, "Transfer cannot be updated, but needs to be replaced to make triggers run");
END;