From 1862611b94f66cf7cb2abc57aa574d01ccc2526d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 12 Oct 2016 09:11:50 -0400 Subject: [PATCH] add Orientation to Events table --- db/zm_create.sql.in | 2 ++ db/zm_update-1.30.8.sql | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 db/zm_update-1.30.8.sql diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index 21a4d4cc1..e9fcfe85e 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -205,6 +205,7 @@ CREATE TABLE `Events` ( `Messaged` tinyint(3) unsigned NOT NULL default '0', `Executed` tinyint(3) unsigned NOT NULL default '0', `Notes` text, + `Orientation` enum('0','90','180','270','hori','vert') NOT NULL default '0', PRIMARY KEY (`Id`,`MonitorId`), KEY `MonitorId` (`MonitorId`), KEY `StartTime` (`StartTime`), @@ -396,6 +397,7 @@ CREATE TABLE `Monitors` ( `WebColour` varchar(32) NOT NULL default 'red', `Exif` tinyint(1) unsigned NOT NULL default '0', `Sequence` smallint(5) unsigned default NULL, + `Orientation` enum('0','90','180','270','hori','vert') NOT NULL default '0', PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; diff --git a/db/zm_update-1.30.8.sql b/db/zm_update-1.30.8.sql new file mode 100644 index 000000000..5e5dd4ccd --- /dev/null +++ b/db/zm_update-1.30.8.sql @@ -0,0 +1,17 @@ +-- +-- This updates a 1.30.7 database to 1.30.8 +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Events' + AND table_schema = DATABASE() + AND column_name = 'Orientation' + ) > 0, +"SELECT 'Column Orientation exists in Events'", +"ALTER TABLE `Events` ADD `Orientation` enum('0','90','180','270','hori','vert') NOT NULL default '0' AFTER Notes", +)); + +PREPARE stmt FROM @s; +EXECUTE stmt;