From 569efd847189914991ff357b08cfd3ce6b806091 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 26 Mar 2021 14:32:06 -0400 Subject: [PATCH] Add MaxImageBufferCount and udpate values as appropriate in update script --- db/zm_create.sql.in | 7 ++++--- db/zm_update-1.35.22.sql | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 db/zm_update-1.35.22.sql diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index 0e8ac7f17..aa62d7d2b 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -497,11 +497,12 @@ CREATE TABLE `Monitors` ( `LabelX` smallint(5) unsigned NOT NULL default '0', `LabelY` smallint(5) unsigned NOT NULL default '0', `LabelSize` smallint(5) unsigned NOT NULL DEFAULT '1', - `ImageBufferCount` smallint(5) unsigned NOT NULL default '100', - `WarmupCount` smallint(5) unsigned NOT NULL default '25', + `ImageBufferCount` smallint(5) unsigned NOT NULL default '3', + `MaxImageBufferCount` smallint(5) unsigned NOT NULL default '0', + `WarmupCount` smallint(5) unsigned NOT NULL default '0', `PreEventCount` smallint(5) unsigned NOT NULL default '10', `PostEventCount` smallint(5) unsigned NOT NULL default '10', - `StreamReplayBuffer` int(10) unsigned NOT NULL default '1000', + `StreamReplayBuffer` int(10) unsigned NOT NULL default '0', `AlarmFrameCount` smallint(5) unsigned NOT NULL default '1', `SectionLength` int(10) unsigned NOT NULL default '600', `MinSectionLength` int(10) unsigned NOT NULL default '10', diff --git a/db/zm_update-1.35.22.sql b/db/zm_update-1.35.22.sql new file mode 100644 index 000000000..2e4fe3a93 --- /dev/null +++ b/db/zm_update-1.35.22.sql @@ -0,0 +1,19 @@ +-- +-- Add MaxImageBufferCount, set it to ImageBufferCount if that was large and set ImageBufferCount to 3 +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Monitors' + AND column_name = 'MaxImageBufferCount' + ) > 0, +"SELECT 'Column MaxImageBufferCount already exists in Monitors'", +"ALTER TABLE `Monitors` ADD `MaxImageBufferCount` smallint(5) unsigned NOT NULL default '0' AFTER `ImageBufferCount`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + +UPDATE `Monitors` SET MaxImageBufferCount=ImageBufferCount WHERE ImageBufferCount >= 20; +UPDATE `Monitors` SET ImageBufferCount = 3; +