From bf9570372b29754730409d5e0de50230d7bbf171 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Fri, 14 Sep 2012 23:18:45 -0500 Subject: [PATCH] Change attachment migration process for upgrade Don't migrate attachments as part of the 1.6* major upgrade. Wait unit transitioning to schema signature dd0022fb, where the new table for file_chunks is created. Incremental developers will already have the columns dropped from the %ticket_attachments table and will receive an error for the cleanup script, but the upgrader is configured to ignore errors from the cleanup scripts. --- include/class.upgrader.php | 6 ++++-- include/upgrader/sql/15b30765-dd0022fb.cleanup.sql | 10 ++++++++++ include/upgrader/sql/c00511c7-7be60a84.cleanup.sql | 8 -------- 3 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 include/upgrader/sql/15b30765-dd0022fb.cleanup.sql diff --git a/include/class.upgrader.php b/include/class.upgrader.php index 7fa6c331f..2c898f646 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 000000000..8ea3afead --- /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 01d69e2d7..eabc72c9e 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`, -- GitLab