From 620806a1bf49677afacf303b9cddb8c615a3e7e6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 12 Mar 2021 09:26:13 -0500 Subject: [PATCH] Add Snapshots and Snapshot_Events Tables. Add HomeView to Users. --- db/zm_create.sql.in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index ae8d500ab..dec8814d2 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -677,6 +677,7 @@ CREATE TABLE `Users` ( `MonitorIds` text, `TokenMinExpiry` BIGINT UNSIGNED NOT NULL DEFAULT 0, `APIEnabled` tinyint(3) UNSIGNED NOT NULL default 1, + `HomeView` varchar(64) NOT NULL DEFAULT '', PRIMARY KEY (`Id`), UNIQUE KEY `UC_Username` (`Username`) ) ENGINE=@ZM_MYSQL_ENGINE@; @@ -1046,6 +1047,26 @@ CREATE TABLE Sessions ( PRIMARY KEY(id) ) ENGINE=InnoDB; +CREATE TABLE Snapshots ( + `Id` int(10) unsigned NOT NULL auto_increment, + `Name` VARCHAR(64), + `Description` TEXT, + `CreatedBy` int(10), + `CreatedOn` datetime default NULL, + PRIMARY KEY(Id) +) ENGINE=InnoDB; + +CREATE TABLE Snapshot_Events ( + `Id` int(10) unsigned NOT NULL auto_increment, + `SnapshotId` int(10) unsigned NOT NULL, + FOREIGN KEY (`SnapshotId`) REFERENCES `Snapshots` (`Id`) ON DELETE CASCADE, + `EventId` bigint unsigned NOT NULL, + FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE, + KEY `Snapshot_Events_SnapshotId_idx` (`SnapshotId`), + PRIMARY KEY(Id) +) ENGINE=InnoDB; + + -- 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 --