Add db update to create Event_Data table

pull/3630/head
Isaac Connor 2022-10-27 14:17:24 -04:00
parent 2965ea2826
commit a25436369f
2 changed files with 38 additions and 0 deletions

View File

@ -276,6 +276,18 @@ CREATE TABLE `Events_Archived` (
KEY `Events_Archived_MonitorId_idx` (`MonitorId`)
) ENGINE=@ZM_MYSQL_ENGINE@;
DROP TABLE IF EXISTS `Event_Data`;
CREATE TABLE `Event_Data` (
`Id` BIGINT unsigned NOT NULL auto_increment,
`EventId` BIGINT unsigned, /* No foreign key for performance */
`MonitorId` int(10) unsigned, /* No foreign key for performance, can be NULL */
`FrameId` int(10) unsigned, /* No foriegn key for performance, can by NULL */
`Timestamp` TIMESTAMP(3),
`Data` TEXT,
PRIMARY KEY (`Id`),
KEY `Event_Data_EventId_FrameId_idx` (`EventId`, `FrameId`)
) ENGINE=@ZM_MYSQL_ENGINE@;
--
-- Table structure for table `Filters`
--

26
db/zm_update-1.37.26.sql Normal file
View File

@ -0,0 +1,26 @@
--
-- This adds the Event_Data Table
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name = 'Event_Data'
AND table_schema = DATABASE()
) > 0,
"SELECT 'Event_Data table exists'",
"
CREATE TABLE `Event_Data` (
`Id` BIGINT unsigned NOT NULL auto_increment,
`EventId` BIGINT unsigned, /* No foreign key for performance */
`MonitorId` int(10) unsigned, /* No foreign key for performance, can be NULL */
`FrameId` int(10) unsigned, /* No foriegn key for performance, can by NULL */
`Timestamp` TIMESTAMP(3),
`Data` TEXT,
PRIMARY KEY (`Id`),
KEY `Event_Data_EventId_FrameId_idx` (`EventId`, `FrameId`)
)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;