From e59ade5391c1e150db105bdf470950e6cb253204 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 22 Jan 2018 14:06:03 -0500 Subject: [PATCH] Only alter MonitorIds if it exists. --- db/zm_update-1.31.7.sql | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/db/zm_update-1.31.7.sql b/db/zm_update-1.31.7.sql index 6634caf5f..1221d9adb 100644 --- a/db/zm_update-1.31.7.sql +++ b/db/zm_update-1.31.7.sql @@ -1 +1,12 @@ -ALTER TABLE Groups MODIFY `MonitorIds` text NOT NULL; +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Groups' + AND column_name = 'MonitorIds' + ) > 0, + "ALTER TABLE Groups MODIFY `MonitorIds` text NOT NULL", + "SELECT 'Groups no longer has MonitorIds'" + )); + +PREPARE stmt FROM @s; +EXECUTE stmt; +