2017-01-19 21:44:22 +01:00
|
|
|
-- Prevent modification of spent 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_spentChangedOutsideTrigger
|
2017-01-19 21:44:22 +01:00
|
|
|
BEFORE UPDATE OF spent ON Credit
|
2017-01-22 21:20:17 +01:00
|
|
|
WHEN NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK)
|
2017-01-19 21:44:22 +01:00
|
|
|
BEGIN
|
2017-02-22 21:58:47 +01:00
|
|
|
SELECT RAISE(ABORT, "spent is set and adjusted automatically according to added Transfer records");
|
2017-01-19 21:44:22 +01:00
|
|
|
END;
|
|
|
|
|