From 1cd71974c4454d5d34ea5faeacdcae218b909178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20=22flowdy=22=20He=C3=9F?= Date: Sat, 25 Jun 2016 17:49:25 +0200 Subject: [PATCH] fixes after testing. Tests still fail. --- schema.sql | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/schema.sql b/schema.sql index c7791c2..3556d93 100644 --- a/schema.sql +++ b/schema.sql @@ -175,7 +175,7 @@ BEGIN billId FROM Transfer WHERE fromCredit = NEW.Id - ORDER BY date DESC + ORDER BY timestamp DESC LIMIT 1 ; @@ -212,11 +212,10 @@ CREATE TRIGGER rebalanceIncreasedCredit WHEN NEW.value > OLD.spent BEGIN - REPLACE INTO Transfer - SELECT OLD.Id AS fromCredit, - billId + REPLACE INTO Transfer (fromCredit, billId) + SELECT OLD.Id, t.billId FROM Transfer t - JOIN CurrentDebts cd ON t.billId = cd.billId + JOIN CurrentDebts cd ON t.billId = cd.billId ; END;