Only alter MonitorIds if it exists.

This commit is contained in:
Isaac Connor 2018-01-22 14:06:03 -05:00
parent 843eee1e13
commit e59ade5391
1 changed files with 12 additions and 1 deletions

View File

@ -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;