diff --git a/include/class.upgrader.php b/include/class.upgrader.php
index 7fa6c331ff542c44e7f4329c4e164f0848cf837e..2c898f646d7dd392790a55007774be1ae54c92a3 100644
--- a/include/class.upgrader.php
+++ b/include/class.upgrader.php
@@ -269,8 +269,6 @@ class Upgrader extends SetupWizard {
         $tasks=array();
         switch($phash) { //Add  patch specific scripted tasks.
             case 'c00511c7-7be60a84': //V1.6 ST- 1.7 * {{MD5('1.6 ST') -> c00511c7c1db65c0cfad04b4842afc57}}
-                $tasks[] = array('func' => 'migrateAttachments2DB',
-                                 'desc' => 'Migrating attachments to database, it might take a while depending on the number of files.');
                 $tasks[] = array('func' => 'migrateSessionFile2DB',
                                  'desc' => 'Transitioning to db-backed sessions');
                 break;
@@ -282,6 +280,10 @@ class Upgrader extends SetupWizard {
                 $tasks[] = array('func' => 'migrateGroupDeptAccess',
                                  'desc' => 'Migrating group\'s department access to a new table');
                 break;
+            case '15b30765-dd0022fb':
+                $tasks[] = array('func' => 'migrateAttachments2DB',
+                                 'desc' => 'Migrating attachments to database, it might take a while depending on the number of files.');
+                break;
         }
 
         //Check IF SQL cleanup exists. 
diff --git a/include/upgrader/sql/15b30765-dd0022fb.cleanup.sql b/include/upgrader/sql/15b30765-dd0022fb.cleanup.sql
new file mode 100644
index 0000000000000000000000000000000000000000..8ea3afead6237d997420f172928e720f1a7f2e7d
--- /dev/null
+++ b/include/upgrader/sql/15b30765-dd0022fb.cleanup.sql
@@ -0,0 +1,10 @@
+
+-- Drop fields we no longer need in the reference table.
+-- NOTE: This was moved from the 1.6* major upgrade script because the
+--       handling of attachments changed with dd0022fb
+ALTER TABLE `%TABLE_PREFIX%ticket_attachment`
+    DROP `file_size`,
+    DROP `file_name`,
+    DROP `file_key`,
+    DROP `updated`,
+    DROP `isdeleted`;
diff --git a/include/upgrader/sql/c00511c7-7be60a84.cleanup.sql b/include/upgrader/sql/c00511c7-7be60a84.cleanup.sql
index 01d69e2d72b732b2d7c3f618fd6e595ccb7c67f7..eabc72c9e22d724978f4f5449901ea5157b2b6a1 100644
--- a/include/upgrader/sql/c00511c7-7be60a84.cleanup.sql
+++ b/include/upgrader/sql/c00511c7-7be60a84.cleanup.sql
@@ -4,14 +4,6 @@ ALTER TABLE `%TABLE_PREFIX%config`
     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`,