2014-12-05 16:29:57 +08:00
|
|
|
--
|
2020-05-13 03:46:07 +08:00
|
|
|
-- This update adds ONVIF features
|
2014-12-05 16:29:57 +08:00
|
|
|
--
|
|
|
|
|
|
|
|
SET @s = (SELECT IF(
|
|
|
|
(SELECT COUNT(*)
|
|
|
|
FROM INFORMATION_SCHEMA.COLUMNS
|
|
|
|
WHERE table_name = 'Monitors'
|
|
|
|
AND table_schema = DATABASE()
|
2020-05-13 03:46:07 +08:00
|
|
|
AND column_name = 'ONVIF_URL'
|
2014-12-05 16:29:57 +08:00
|
|
|
) > 0,
|
2020-05-13 03:46:07 +08:00
|
|
|
"SELECT 'Column ONVIF_URL already exists in Monitors'",
|
|
|
|
"ALTER TABLE `Monitors` ADD COLUMN `ONVIF_URL` VARCHAR(255) NOT NULL DEFAULT '' AFTER `Triggers`"
|
2014-12-05 16:29:57 +08:00
|
|
|
));
|
|
|
|
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|
|
|
|
|
|
|
|
SET @s = (SELECT IF(
|
|
|
|
(SELECT COUNT(*)
|
|
|
|
FROM INFORMATION_SCHEMA.COLUMNS
|
|
|
|
WHERE table_name = 'Monitors'
|
|
|
|
AND table_schema = DATABASE()
|
2020-05-13 03:46:07 +08:00
|
|
|
AND column_name = 'ONVIF_Username'
|
2014-12-05 16:29:57 +08:00
|
|
|
) > 0,
|
2020-05-13 03:46:07 +08:00
|
|
|
"SELECT 'Column ONVIF_Username already exists in Monitors'",
|
|
|
|
"ALTER TABLE `Monitors` ADD COLUMN `ONVIF_Username` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ONVIF_URL`"
|
2014-12-05 16:29:57 +08:00
|
|
|
));
|
|
|
|
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|
|
|
|
|
|
|
|
SET @s = (SELECT IF(
|
2020-05-13 03:46:07 +08:00
|
|
|
(SELECT COUNT(*)
|
|
|
|
FROM INFORMATION_SCHEMA.COLUMNS
|
|
|
|
WHERE table_name = 'Monitors'
|
|
|
|
AND table_schema = DATABASE()
|
|
|
|
AND column_name = 'ONVIF_Password'
|
|
|
|
) > 0,
|
|
|
|
"SELECT 'Column ONVIF_Password already exists in Monitors'",
|
|
|
|
"ALTER TABLE `Monitors` ADD COLUMN `ONVIF_Password` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ONVIF_Username`"
|
2014-12-05 16:29:57 +08:00
|
|
|
));
|
|
|
|
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|
2020-05-13 03:46:07 +08:00
|
|
|
|
|
|
|
SET @s = (SELECT IF(
|
|
|
|
(SELECT COUNT(*)
|
|
|
|
FROM INFORMATION_SCHEMA.COLUMNS
|
|
|
|
WHERE table_name = 'Monitors'
|
|
|
|
AND table_schema = DATABASE()
|
|
|
|
AND column_name = 'ONVIF_Options'
|
|
|
|
) > 0,
|
|
|
|
"SELECT 'Column ONVIF_Options already exists in Monitors'",
|
|
|
|
"ALTER TABLE `Monitors` ADD COLUMN `ONVIF_Options` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ONVIF_Password`"
|
|
|
|
));
|
|
|
|
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|
|
|
|
|