diff --git a/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql b/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql index 87d968fc081dec90374d2206bd8e1e5bd90e180c..dcc52a01494d34084f3d099983a802bdc518a6fd 100644 --- a/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql +++ b/include/upgrader/streams/core/0d6099a6-98ad7d55.cleanup.sql @@ -17,8 +17,8 @@ SET @s = (SELECT IF( AND table_schema = DATABASE() AND column_name = 'updated' ) > 0, - "SELECT 1", - "ALTER TABLE `%TABLE_PREFIX%team_member` DROP `updated`" + "ALTER TABLE `%TABLE_PREFIX%team_member` DROP `updated`", + "SELECT 1" )); PREPARE stmt FROM @s; EXECUTE stmt; @@ -31,8 +31,8 @@ SET @s = (SELECT IF( AND table_schema = DATABASE() AND column_name = 'views' ) > 0, - "SELECT 1", - "ALTER TABLE `%TABLE_PREFIX%faq` DROP `views`, DROP `score`" + "ALTER TABLE `%TABLE_PREFIX%faq` DROP `views`, DROP `score`", + "SELECT 1" )); PREPARE stmt FROM @s; EXECUTE stmt; diff --git a/include/upgrader/streams/core/36f6b328-5cd0a25a.cleanup.sql b/include/upgrader/streams/core/36f6b328-5cd0a25a.cleanup.sql index 800c8127673c19f3628eb3b4b385a691cac6e96b..533991fb497d35e870ebcaf454475c6c45653c09 100644 --- a/include/upgrader/streams/core/36f6b328-5cd0a25a.cleanup.sql +++ b/include/upgrader/streams/core/36f6b328-5cd0a25a.cleanup.sql @@ -1,5 +1,16 @@ -ALTER TABLE `%TABLE_PREFIX%thread` - DROP COLUMN `tid`; +-- Drop `tid` from thread (if it exists) +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = '%TABLE_PREFIX%thread' + AND table_schema = DATABASE() + AND column_name = 'tid' + ) > 0, + "ALTER TABLE `%TABLE_PREFIX%thread` DROP COLUMN `tid`", + "SELECT 1" +)); +PREPARE stmt FROM @s; +EXECUTE stmt; ALTER TABLE `%TABLE_PREFIX%thread_entry` DROP COLUMN `ticket_id`;