Add Tags and Event_Tags tables to db creation

This commit is contained in:
Isaac Connor
2023-10-04 16:25:20 -04:00
parent 3836e7d2a7
commit bc27af71a5

View File

@@ -1219,6 +1219,26 @@ CREATE TABLE Reports (
PRIMARY KEY(Id)
) ENGINE=@ZM_MYSQL_ENGINE@;
CREATE TABLE `Tags` (
`Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(64) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
`CreateDate` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`CreatedBy` int(10) unsigned,
`LastAssignedDate` dateTime,
PRIMARY KEY (`Id`),
UNIQUE(`Name`)
) ENGINE=@ZM_MYSQL_ENGINE@;
CREATE TABLE `Events_Tags` (
`TagId` bigint(20) unsigned NOT NULL,
`EventId` bigint(20) unsigned NOT NULL,
`AssignedDate` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`AssignedBy` int(10) unsigned,
PRIMARY KEY (`TagId`, `EventId`),
CONSTRAINT `Events_Tags_ibfk_1` FOREIGN KEY (`TagId`) REFERENCES `Tags` (`Id`) ON DELETE CASCADE,
CONSTRAINT `Events_Tags_ibfk_2` FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE
) ENGINE=@ZM_MYSQL_ENGINE@;
-- We generally don't alter triggers, we drop and re-create them, so let's keep them in a separate file that we can just source in update scripts.
source @PKGDATADIR@/db/triggers.sql