diff --git a/schema/triggers/enforceFixedCredit.sql b/schema/triggers/x_changedCredit.sql similarity index 88% rename from schema/triggers/enforceFixedCredit.sql rename to schema/triggers/x_changedCredit.sql index 037a86f..539a529 100644 --- a/schema/triggers/enforceFixedCredit.sql +++ b/schema/triggers/x_changedCredit.sql @@ -1,4 +1,4 @@ -CREATE TRIGGER enforceFixedCredit +CREATE TRIGGER x_changedCredit BEFORE UPDATE OF account, value ON Credit WHEN EXISTS (SELECT * FROM Transfer WHERE credId=NEW.credId) AND NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK) diff --git a/schema/triggers/enforceFixedDebit.sql b/schema/triggers/x_changedDebit.sql similarity index 89% rename from schema/triggers/enforceFixedDebit.sql rename to schema/triggers/x_changedDebit.sql index 01dfded..c2003e0 100644 --- a/schema/triggers/enforceFixedDebit.sql +++ b/schema/triggers/x_changedDebit.sql @@ -1,4 +1,4 @@ -CREATE TRIGGER enforceFixedDebit +CREATE TRIGGER x_changedDebit BEFORE UPDATE OF debtor, transferCredit, value ON Debit WHEN EXISTS (SELECT * FROM Transfer WHERE billId=NEW.billId) AND NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK LIMIT 1) diff --git a/schema/triggers/enforceImmutableTransfer.sql b/schema/triggers/x_changedTransfer.sql similarity index 88% rename from schema/triggers/enforceImmutableTransfer.sql rename to schema/triggers/x_changedTransfer.sql index ac2cebf..5131168 100644 --- a/schema/triggers/enforceImmutableTransfer.sql +++ b/schema/triggers/x_changedTransfer.sql @@ -1,4 +1,4 @@ -CREATE TRIGGER enforceImmutableTransfer +CREATE TRIGGER x_changedTransfer BEFORE UPDATE OF timestamp, credId, billId, amount ON Transfer -- Allow update of note WHEN OLD.amount IS NOT NULL AND NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK) diff --git a/schema/triggers/enforceDebtImmutableOutsideTrigger.sql b/schema/triggers/x_paidChangedOutsideTrigger.sql similarity index 87% rename from schema/triggers/enforceDebtImmutableOutsideTrigger.sql rename to schema/triggers/x_paidChangedOutsideTrigger.sql index 1310f87..346a715 100644 --- a/schema/triggers/enforceDebtImmutableOutsideTrigger.sql +++ b/schema/triggers/x_paidChangedOutsideTrigger.sql @@ -1,6 +1,6 @@ -- Prevent modification of paid value outside triggers which must adjust it exclusively -- when new transfer records are inserted -CREATE TRIGGER enforceDebtImmutableOutsideTrigger +CREATE TRIGGER x_paidChangedOutsideTrigger BEFORE UPDATE OF paid ON Debit WHEN NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK LIMIT 1) BEGIN diff --git a/schema/triggers/enforceZeroPaidAtStart.sql b/schema/triggers/x_paidFromBeginning.sql similarity index 75% rename from schema/triggers/enforceZeroPaidAtStart.sql rename to schema/triggers/x_paidFromBeginning.sql index 467e364..4aa1ae6 100644 --- a/schema/triggers/enforceZeroPaidAtStart.sql +++ b/schema/triggers/x_paidFromBeginning.sql @@ -1,4 +1,4 @@ -CREATE TRIGGER enforceZeroPaidAtStart +CREATE TRIGGER x_paidFromBeginning BEFORE INSERT ON Debit BEGIN SELECT RAISE(FAIL, "Debt must be initially unpaid") diff --git a/schema/triggers/enforceSpentImmutableOutsideTrigger.sql b/schema/triggers/x_spentChangedOutsideTrigger.sql similarity index 87% rename from schema/triggers/enforceSpentImmutableOutsideTrigger.sql rename to schema/triggers/x_spentChangedOutsideTrigger.sql index 77fec39..430540a 100644 --- a/schema/triggers/enforceSpentImmutableOutsideTrigger.sql +++ b/schema/triggers/x_spentChangedOutsideTrigger.sql @@ -1,6 +1,6 @@ -- Prevent modification of spent value outside triggers which must adjust it exclusively -- when new transfer records are inserted -CREATE TRIGGER enforceSpentImmutableOutsideTrigger +CREATE TRIGGER x_spentChangedOutsideTrigger BEFORE UPDATE OF spent ON Credit WHEN NOT EXISTS (SELECT * FROM __INTERNAL_TRIGGER_STACK) BEGIN diff --git a/schema/triggers/enforceZeroSpentAtStart.sql b/schema/triggers/x_spentFromBeginning.sql similarity index 76% rename from schema/triggers/enforceZeroSpentAtStart.sql rename to schema/triggers/x_spentFromBeginning.sql index 623cf37..c84ee91 100644 --- a/schema/triggers/enforceZeroSpentAtStart.sql +++ b/schema/triggers/x_spentFromBeginning.sql @@ -1,4 +1,4 @@ -CREATE TRIGGER enforceZeroSpentAtStart +CREATE TRIGGER x_spentFromBeginning BEFORE INSERT ON Credit BEGIN SELECT RAISE(FAIL, "credit must be initially unused")