diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index ffb56347f..a9534d53f 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -273,10 +273,26 @@ CREATE TABLE `Events_Archived` ( ) ENGINE=@ZM_MYSQL_ENGINE@; -drop trigger if exists event_update_trigger; +drop procedure if exists update_storage_stats; delimiter // +create procedure update_storage_stats(IN StorageId smallint(5), IN space BIGINT) + +sql security invoker + +deterministic + +begin + + update Storage set DiskSpace = DiskSpace + space where Id = StorageId; + +end; + +// + +drop trigger if exists event_update_trigger// + CREATE TRIGGER event_update_trigger AFTER UPDATE ON Events FOR EACH ROW BEGIN