Skip to content

Commit 8f50d7c

Browse files
Merge remote-tracking branch 'upstream' into ai_server
2 parents 889a5d1 + 8016631 commit 8f50d7c

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

db/zm_create.sql.in

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -892,14 +892,14 @@ CREATE TABLE `ZonePresets` (
892892
`CheckMethod` enum('AlarmedPixels','FilteredPixels','Blobs') NOT NULL default 'Blobs',
893893
`MinPixelThreshold` smallint(5) unsigned default NULL,
894894
`MaxPixelThreshold` smallint(5) unsigned default NULL,
895-
`MinAlarmPixels` DECIMAL(7,2) unsigned default NULL,
896-
`MaxAlarmPixels` DECIMAL(7,2) unsigned default NULL,
895+
`MinAlarmPixels` DECIMAL(10,2) unsigned default NULL,
896+
`MaxAlarmPixels` DECIMAL(10,2) unsigned default NULL,
897897
`FilterX` tinyint(3) unsigned default NULL,
898898
`FilterY` tinyint(3) unsigned default NULL,
899-
`MinFilterPixels` DECIMAL(7,2) unsigned default NULL,
900-
`MaxFilterPixels` DECIMAL(7,2) unsigned default NULL,
901-
`MinBlobPixels` DECIMAL(7,2) unsigned default NULL,
902-
`MaxBlobPixels` DECIMAL(7,2) unsigned default NULL,
899+
`MinFilterPixels` DECIMAL(10,2) unsigned default NULL,
900+
`MaxFilterPixels` DECIMAL(10,2) unsigned default NULL,
901+
`MinBlobPixels` DECIMAL(10,2) unsigned default NULL,
902+
`MaxBlobPixels` DECIMAL(10,2) unsigned default NULL,
903903
`MinBlobs` smallint(5) unsigned default NULL,
904904
`MaxBlobs` smallint(5) unsigned default NULL,
905905
`OverloadFrames` smallint(5) unsigned NOT NULL default '0',
@@ -926,14 +926,14 @@ CREATE TABLE `Zones` (
926926
`CheckMethod` enum('AlarmedPixels','FilteredPixels','Blobs') NOT NULL default 'Blobs',
927927
`MinPixelThreshold` smallint(5) unsigned default NULL,
928928
`MaxPixelThreshold` smallint(5) unsigned default NULL,
929-
`MinAlarmPixels` DECIMAL(7,2) unsigned default NULL,
930-
`MaxAlarmPixels` DECIMAL(7,2) unsigned default NULL,
929+
`MinAlarmPixels` DECIMAL(10,2) unsigned default NULL,
930+
`MaxAlarmPixels` DECIMAL(10,2) unsigned default NULL,
931931
`FilterX` tinyint(3) unsigned default NULL,
932932
`FilterY` tinyint(3) unsigned default NULL,
933-
`MinFilterPixels` DECIMAL(7,2) unsigned default NULL,
934-
`MaxFilterPixels` DECIMAL(7,2) unsigned default NULL,
935-
`MinBlobPixels` DECIMAL(7,2) unsigned default NULL,
936-
`MaxBlobPixels` DECIMAL(7,2) unsigned default NULL,
933+
`MinFilterPixels` DECIMAL(10,2) unsigned default NULL,
934+
`MaxFilterPixels` DECIMAL(10,2) unsigned default NULL,
935+
`MinBlobPixels` DECIMAL(10,2) unsigned default NULL,
936+
`MaxBlobPixels` DECIMAL(10,2) unsigned default NULL,
937937
`MinBlobs` smallint(5) unsigned default NULL,
938938
`MaxBlobs` smallint(5) unsigned default NULL,
939939
`OverloadFrames` smallint(5) unsigned NOT NULL default '0',

db/zm_update-1.39.3.sql

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
-- First convert existing pixel count values to percentages WHILE columns
77
-- are still INT (values 0-100 fit in INT; ALTER to DECIMAL would fail on
8-
-- large pixel counts that exceed DECIMAL(7,2) max of 99999.99).
8+
-- large pixel counts that exceed DECIMAL(10,2) max of 99999.99).
99
--
1010
-- Zone pixel area = (Zones.Area * Monitors.Width * Monitors.Height) / 10000
1111
-- where Zones.Area is in percentage-space (0-10000) from zm_update-1.39.2.sql.
@@ -59,22 +59,22 @@ WHERE z.Coords LIKE '%.%'
5959
OR z.MinFilterPixels > 100 OR z.MaxFilterPixels > 100
6060
OR z.MinBlobPixels > 100 OR z.MaxBlobPixels > 100);
6161

62-
-- Now change threshold columns from int to DECIMAL(7,2) to store percentages
62+
-- Now change threshold columns from int to DECIMAL(10,2) to store percentages
6363
-- with 2 decimal places (e.g. 25.50 = 25.50% of zone area).
64-
-- Values are now 0-100 from the UPDATE above, so they fit in DECIMAL(7,2).
64+
-- Values are now 0-100 from the UPDATE above, so they fit in DECIMAL(10,2).
6565

6666
SET @s = (SELECT IF(
6767
(SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
6868
AND table_name = 'Zones' AND column_name = 'MinAlarmPixels'
6969
) = 'decimal',
7070
"SELECT 'Zones threshold columns already DECIMAL'",
7171
"ALTER TABLE `Zones`
72-
MODIFY `MinAlarmPixels` DECIMAL(7,2) unsigned default NULL,
73-
MODIFY `MaxAlarmPixels` DECIMAL(7,2) unsigned default NULL,
74-
MODIFY `MinFilterPixels` DECIMAL(7,2) unsigned default NULL,
75-
MODIFY `MaxFilterPixels` DECIMAL(7,2) unsigned default NULL,
76-
MODIFY `MinBlobPixels` DECIMAL(7,2) unsigned default NULL,
77-
MODIFY `MaxBlobPixels` DECIMAL(7,2) unsigned default NULL"
72+
MODIFY `MinAlarmPixels` DECIMAL(10,2) unsigned default NULL,
73+
MODIFY `MaxAlarmPixels` DECIMAL(10,2) unsigned default NULL,
74+
MODIFY `MinFilterPixels` DECIMAL(10,2) unsigned default NULL,
75+
MODIFY `MaxFilterPixels` DECIMAL(10,2) unsigned default NULL,
76+
MODIFY `MinBlobPixels` DECIMAL(10,2) unsigned default NULL,
77+
MODIFY `MaxBlobPixels` DECIMAL(10,2) unsigned default NULL"
7878
));
7979

8080
PREPARE stmt FROM @s;
@@ -88,12 +88,12 @@ SET @s = (SELECT IF(
8888
) = 'decimal',
8989
"SELECT 'ZonePresets threshold columns already DECIMAL'",
9090
"ALTER TABLE `ZonePresets`
91-
MODIFY `MinAlarmPixels` DECIMAL(7,2) unsigned default NULL,
92-
MODIFY `MaxAlarmPixels` DECIMAL(7,2) unsigned default NULL,
93-
MODIFY `MinFilterPixels` DECIMAL(7,2) unsigned default NULL,
94-
MODIFY `MaxFilterPixels` DECIMAL(7,2) unsigned default NULL,
95-
MODIFY `MinBlobPixels` DECIMAL(7,2) unsigned default NULL,
96-
MODIFY `MaxBlobPixels` DECIMAL(7,2) unsigned default NULL"
91+
MODIFY `MinAlarmPixels` DECIMAL(10,2) unsigned default NULL,
92+
MODIFY `MaxAlarmPixels` DECIMAL(10,2) unsigned default NULL,
93+
MODIFY `MinFilterPixels` DECIMAL(10,2) unsigned default NULL,
94+
MODIFY `MaxFilterPixels` DECIMAL(10,2) unsigned default NULL,
95+
MODIFY `MinBlobPixels` DECIMAL(10,2) unsigned default NULL,
96+
MODIFY `MaxBlobPixels` DECIMAL(10,2) unsigned default NULL"
9797
));
9898

9999
PREPARE stmt FROM @s;

0 commit comments

Comments
 (0)