zoneminder/db/zm_update-1.31.18.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
809 B
MySQL
Raw Normal View History

2017-12-23 03:38:59 +08:00
SET @s = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
AND table_name = 'Storage'
AND column_name = 'ServerId'
) > 0,
"SELECT 'Column ServerId already exists in Storage'",
"ALTER TABLE Storage ADD `ServerId` int(10) unsigned AFTER `Scheme`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
SET @s = (SELECT IF(
(SELECT COUNT(*) FROM Filters WHERE Name = 'Update DiskSpace'
2018-01-02 02:19:16 +08:00
AND Query = '{"terms":[{"attr":"DiskSpace","op":"IS","val":"NULL"}]}'
) > 0,
"SELECT 'Update Disk Space Filter already exists.'",
2018-01-02 02:19:16 +08:00
"INSERT INTO Filters (Name,Query,UpdateDiskSpace,Background) values ('Update DiskSpace','{\"terms\":[{\"attr\":\"DiskSpace\",\"op\":\"IS\",\"val\":\"NULL\"}]}',1,1)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;