diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index 01176eb43..2cff3c576 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -762,6 +762,14 @@ CREATE TABLE Maps ( `ParentId` int(1) unsigned, PRIMARY KEY (`Id`) ); + +CREATE TABLE MontageLayouts ( + `Id` int(10) unsigned NOT NULL auto_increment, + `Name` TEXT NOT NULL, + `Positions` JSON, + PRIMARY KEY (`Id`) +); + -- -- Apply the initial configuration -- diff --git a/db/zm_update-1.31.11.sql b/db/zm_update-1.31.11.sql new file mode 100644 index 000000000..de17d85d9 --- /dev/null +++ b/db/zm_update-1.31.11.sql @@ -0,0 +1,69 @@ +-- +-- Add UpdateDiskSpace action to Filters +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Filters' + AND column_name = 'UpdateDiskSpace' + ) > 0, +"SELECT 'Column UpdateDiskSpace already exists in Filters'", +"ALTER TABLE Filters ADD `UpdateDiskSpace` tinyint(3) unsigned NOT NULL default '0' AFTER `AutoDelete`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; +-- +-- Update Logs table to have some Indexes +-- +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Logs' + AND table_schema = DATABASE() + AND index_name = 'Logs_TimeKey_idx' + ) > 0, +"SELECT 'Logs_TimeKey_idx already exists on Logs table'", +"CREATE INDEX `Logs_TimeKey_idx` ON `Logs` (`TimeKey`)" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Logs' + AND table_schema = DATABASE() + AND index_name = 'Logs_Level_idx' + ) > 0, +"SELECT 'Logs_Level_idx already exists on Logs table'", +"CREATE INDEX `Logs_Level_idx` ON `Logs` (`Level`)" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Monitors' + AND column_name = 'OutputCodec' + ) > 0, +"SELECT 'Column OutputCodec already exists in Monitors'", +"ALTER TABLE `Monitors` ADD `OutputCodec` enum('h264','mjpeg') AFTER `VideoWriter`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Monitors' + AND column_name = 'OutputContainer' + ) > 0, +"SELECT 'Column OutputContainer already exists in Monitors'", +"ALTER TABLE `Monitors` ADD `OutputContainer` enum('mp4','mkv') AFTER `OutputCodec`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; diff --git a/db/zm_update-1.31.12.sql b/db/zm_update-1.31.12.sql new file mode 100644 index 000000000..a267728f5 --- /dev/null +++ b/db/zm_update-1.31.12.sql @@ -0,0 +1,23 @@ +-- +-- This adds Manufacturers and Models +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.TABLES + WHERE table_name = 'MontageLayouts' + AND table_schema = DATABASE() + ) > 0, + "SELECT 'MontageLayouts table exists'", + " + CREATE TABLE MontageLayouts ( + `Id` int(10) unsigned NOT NULL auto_increment, + `Name` TEXT NOT NULL, + `Positions` JSON, + PRIMARY KEY (`Id`) +); +" + )); + +PREPARE stmt FROM @s; +EXECUTE stmt;