use COALESCE to ensure integer values
This commit is contained in:
parent
e25af4b40c
commit
12c4ab07ea
|
@ -378,14 +378,14 @@ BEGIN
|
||||||
DELETE FROM Events_Archived WHERE EventId=OLD.Id;
|
DELETE FROM Events_Archived WHERE EventId=OLD.Id;
|
||||||
UPDATE Monitors SET
|
UPDATE Monitors SET
|
||||||
ArchivedEvents = ArchivedEvents - 1,
|
ArchivedEvents = ArchivedEvents - 1,
|
||||||
ArchivedEventDiskSpace = ArchivedEventDiskSpace - OLD.DiskSpace,
|
ArchivedEventDiskSpace = COALESCE(ArchivedEventDiskSpace,0) - COALESCE(OLD.DiskSpace,0),
|
||||||
TotalEvents = TotalEvents - 1,
|
TotalEvents = TotalEvents - 1,
|
||||||
TotalEventDiskSpace = TotalEventDiskSpace - OLD.DiskSpace
|
TotalEventDiskSpace = COALESCE(TotalEventDiskSpace,0) - COALESCE(OLD.DiskSpace,0)
|
||||||
WHERE Id=OLD.MonitorId;
|
WHERE Id=OLD.MonitorId;
|
||||||
ELSE
|
ELSE
|
||||||
UPDATE Monitors SET
|
UPDATE Monitors SET
|
||||||
TotalEvents = TotalEvents-1,
|
TotalEvents = TotalEvents-1,
|
||||||
TotalEventDiskSpace=TotalEventDiskSpace-OLD.DiskSpace
|
TotalEventDiskSpace=COALESCE(TotalEventDiskSpace,0)-COALESCE(OLD.DiskSpace,0)
|
||||||
WHERE Id=OLD.MonitorId;
|
WHERE Id=OLD.MonitorId;
|
||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
|
|
Loading…
Reference in New Issue