From 936aa00a5ef99287029ac39abfec8b65a2b56bd7 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 15 Aug 2015 12:00:48 -0500 Subject: [PATCH] add sql bits --- db/zm_create.sql.in | 1 + db/zm_update-1.28.101.sql | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 db/zm_update-1.28.101.sql diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index c52c5741e..f44fac812 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -461,6 +461,7 @@ CREATE TABLE `Users` ( `Events` enum('None','View','Edit') NOT NULL default 'None', `Control` enum('None','View','Edit') NOT NULL default 'None', `Monitors` enum('None','View','Edit') NOT NULL default 'None', + `Groups` enum('None','View','Edit') NOT NULL default 'None', `Devices` enum('None','View','Edit') NOT NULL default 'None', `System` enum('None','View','Edit') NOT NULL default 'None', `MaxBandwidth` varchar(16) NOT NULL default '', diff --git a/db/zm_update-1.28.101.sql b/db/zm_update-1.28.101.sql new file mode 100644 index 000000000..eb0fc5166 --- /dev/null +++ b/db/zm_update-1.28.101.sql @@ -0,0 +1,23 @@ +-- +-- This updates a 1.28.100 database to 1.28.101 +-- + +-- +-- Add Groups column to Users +-- + + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Groups' + ) > 0, +"SELECT 'Column Groups exists in Users'", +"ALTER TABLE Monitors ADD COLUMN `Groups` ENUM('None','View','Edit') NOT NULL DEFAULT 'None' AFTER `Monitors`; +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; +