need the update file

This commit is contained in:
Isaac Connor 2017-11-26 15:08:12 -05:00
parent d6bc727c9c
commit 4a884afecb
1 changed files with 14 additions and 0 deletions

14
db/zm_update-1.31.15.sql Normal file
View File

@ -0,0 +1,14 @@
SET @s = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
AND table_name = 'Monitors'
AND column_name = 'ZoneCount'
) > 0,
"SELECT 'Column ZoneCount already exists in Monitors'",
"ALTER TABLE `Monitors` ADD `ZoneCount` TINYINT NOT NULL DEFAULT 0 AFTER `ArchivedEventDiskSpace`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
UPDATE Monitors SET ZoneCount=(SELECT COUNT(Id) FROM Zones WHERE MonitorId=Monitors.Id);