From 348764985bc724e5806a33aceb590b9d719f6bc6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 8 Jan 2018 15:42:28 -0500 Subject: [PATCH] Fix Storage DiskSpace updating when Event.DiskSpace IS NULL --- db/zm_update-1.31.19.sql | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/db/zm_update-1.31.19.sql b/db/zm_update-1.31.19.sql index 43c9c5005..f23addd69 100644 --- a/db/zm_update-1.31.19.sql +++ b/db/zm_update-1.31.19.sql @@ -36,10 +36,16 @@ begin set diff = NEW.DiskSpace - OLD.DiskSpace; IF ( NEW.StorageId = OLD.StorageID ) THEN + IF ( diff ) THEN call update_storage_stats(OLD.StorageId, diff); + END IF; ELSE + IF ( NEW.DiskSpace ) THEN call update_storage_stats(NEW.StorageId, NEW.DiskSpace); + END IF; + IF ( OLD.DiskSpace ) THEN call update_storage_stats(OLD.StorageId, -OLD.DiskSpace); + END IF; END IF; end; @@ -51,7 +57,7 @@ delimiter ; drop trigger if exists event_insert_trigger; delimiter // - +/* create trigger event_insert_trigger after insert @@ -65,7 +71,7 @@ begin call update_storage_stats(NEW.StorageId, NEW.DiskSpace); end; - +*/ // delimiter ;