Add StartupDelay to Monitors

add_startup_delay
Isaac Connor 2024-03-18 12:55:19 -04:00
parent ebcc2cd045
commit 1d7efa7088
2 changed files with 19 additions and 0 deletions

View File

@ -617,6 +617,7 @@ CREATE TABLE `Monitors` (
`Importance` enum('Normal','Less','Not') NOT NULL default 'Normal',
`MQTT_Enabled` BOOLEAN NOT NULL DEFAULT false,
`MQTT_Subscriptions` varchar(255) default '',
`StartupDelay` INT NOT NULL DEFAULT 0,
PRIMARY KEY (`Id`)
) ENGINE=@ZM_MYSQL_ENGINE@;

18
db/zm_update-1.37.56.sql Normal file
View File

@ -0,0 +1,18 @@
--
-- Update Monitors table to have StartupDelay
--
SELECT 'Checking for StartupDelay in Monitors';
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Monitors'
AND table_schema = DATABASE()
AND column_name = 'StartupDelay'
) > 0,
"SELECT 'Column StartupDelay already exists on Monitors'",
"ALTER TABLE Monitors ADD `StartupDelay` INT NOT NULL DEFAULT 0 AFTER `MQTT_Subscriptions`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;