From a678f55a25f723f7b7e44ce8b2f6371c1a7c6aa9 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 28 Jun 2012 17:29:01 -0400
Subject: [PATCH] Delay dropping columns from the %config table

When the `ostversion` column is removed from the %config table, the system
will immediately switch to database-backed sessions. Because the
administrator upgrading the system originally logged in with a file-based
session, it must be migrated to the database before removing the column.
---
 .../patches/c00511c7-7be60a84.cleanup.sql     | 25 +++++++++++++++++++
 .../patches/c00511c7-7be60a84.patch.sql       |  6 -----
 2 files changed, 25 insertions(+), 6 deletions(-)
 create mode 100644 include/upgrader/patches/c00511c7-7be60a84.cleanup.sql

diff --git a/include/upgrader/patches/c00511c7-7be60a84.cleanup.sql b/include/upgrader/patches/c00511c7-7be60a84.cleanup.sql
new file mode 100644
index 000000000..01d69e2d7
--- /dev/null
+++ b/include/upgrader/patches/c00511c7-7be60a84.cleanup.sql
@@ -0,0 +1,25 @@
+-- Drop columns we nolonger need - (must be at the very bottom or after session table is created)
+ALTER TABLE `%TABLE_PREFIX%config`
+    DROP COLUMN `ostversion`,
+    DROP COLUMN `timezone_offset`,
+    DROP COLUMN `api_passphrase`;
+
+-- Drop fields we no longer need in the reference table.
+ALTER TABLE `%TABLE_PREFIX%ticket_attachment`
+    DROP `file_size`,
+    DROP `file_name`,
+    DROP `file_key`,
+    DROP `updated`,
+    DROP `isdeleted`;
+
+-- Drop fields we no longer need in staff table.
+ALTER TABLE `%TABLE_PREFIX%staff`
+    DROP `append_signature`,
+    DROP `timezone_offset`;
+
+-- Drop fields we no longer need in department table.
+ALTER TABLE `%TABLE_PREFIX%department`
+    DROP `can_append_signature`;
+
+-- Banlist table has been migrated to the email_filter_rule table
+DROP TABLE `%TABLE_PREFIX%email_banlist`;
diff --git a/include/upgrader/patches/c00511c7-7be60a84.patch.sql b/include/upgrader/patches/c00511c7-7be60a84.patch.sql
index 89dbb3143..638248b97 100644
--- a/include/upgrader/patches/c00511c7-7be60a84.patch.sql
+++ b/include/upgrader/patches/c00511c7-7be60a84.patch.sql
@@ -302,12 +302,6 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%faq_topic` (
   PRIMARY KEY  (`faq_id`,`topic_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
--- Drop columns we nolonger need - (must be at the very bottom or after session table is created)
-ALTER TABLE `%TABLE_PREFIX%config`
-    DROP COLUMN `ostversion`,
-    DROP COLUMN `timezone_offset`,
-    DROP COLUMN `api_passphrase`;
-
 
 UPDATE `%TABLE_PREFIX%config`
     SET `schema_signature`='7be60a8432e44989e782d5914ef784d2'; 
-- 
GitLab