2017-01-19 21:44:22 +01:00
|
|
|
CREATE TRIGGER enforceImmutableTransfer
|
2017-01-28 14:00:20 +01:00
|
|
|
BEFORE UPDATE OF timestamp, credId, billId, amount ON Transfer -- Allow update of note
|
2017-01-19 21:44:22 +01:00
|
|
|
WHEN OLD.amount IS NOT NULL
|
2017-01-22 21:20:17 +01:00
|
|
|
AND NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK)
|
2017-01-19 21:44:22 +01:00
|
|
|
BEGIN
|
|
|
|
SELECT RAISE(FAIL, "Transfer cannot be updated, but needs to be replaced to make triggers run");
|
|
|
|
END;
|
|
|
|
|