2017-01-19 21:44:22 +01:00
|
|
|
CREATE TRIGGER enforceFixedCredit
|
|
|
|
BEFORE UPDATE OF account, value ON Credit
|
|
|
|
WHEN EXISTS (SELECT * FROM Transfer WHERE credId=NEW.credId)
|
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, "Credit involved in transactions to revoke at first");
|
|
|
|
END;
|
|
|
|
|