From 90dc2d691a39133332fc405fa01be6e8c15ead1c Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 2 Feb 2018 22:05:23 -0500 Subject: [PATCH] Deactivated some migrations as they're no longer needed.... might break some new installs --- .../Statuses/AddIntColumnUpDropTableDown.php | 6 ++++-- .../Pre140/Statuses/CreateStatusesTable.php | 5 ++++- .../Pre140/Statuses/DropOldStatusColumn.php | 14 ++++++++------ .../Pre140/Statuses/MoveStatusesToNewColumn.php | 14 ++++++++------ .../Pre140/Statuses/RenameTempColumn.php | 6 ++++-- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/install/migrations/Pre140/Statuses/AddIntColumnUpDropTableDown.php b/install/migrations/Pre140/Statuses/AddIntColumnUpDropTableDown.php index b6bf841e..c3053741 100644 --- a/install/migrations/Pre140/Statuses/AddIntColumnUpDropTableDown.php +++ b/install/migrations/Pre140/Statuses/AddIntColumnUpDropTableDown.php @@ -7,10 +7,12 @@ use AbstractMigration; class AddIntColumnUpDropTableDown extends AbstractMigration { function up($hesk_settings) { - $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `status_int` INT NOT NULL DEFAULT 0 AFTER `status`;"); + // We no longer need to do this thanks to HESK 2.7.0 + //$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `status_int` INT NOT NULL DEFAULT 0 AFTER `status`;"); } function down($hesk_settings) { - $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); + // Moved to migration #2 for clarity + //$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); } } \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/CreateStatusesTable.php b/install/migrations/Pre140/Statuses/CreateStatusesTable.php index 0d7dbef7..8b2321c2 100644 --- a/install/migrations/Pre140/Statuses/CreateStatusesTable.php +++ b/install/migrations/Pre140/Statuses/CreateStatusesTable.php @@ -23,6 +23,9 @@ class CreateStatusesTable extends \AbstractMigration { } function down($hesk_settings) { - $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `status_int` INT NOT NULL AFTER `status`;"); + // We no longer need to do this thanks to HESK 2.7.0 + //$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `status_int` INT NOT NULL AFTER `status`;"); + // Moved from migration #1 + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); } } \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/DropOldStatusColumn.php b/install/migrations/Pre140/Statuses/DropOldStatusColumn.php index eb41f6b6..0e6d136a 100644 --- a/install/migrations/Pre140/Statuses/DropOldStatusColumn.php +++ b/install/migrations/Pre140/Statuses/DropOldStatusColumn.php @@ -8,14 +8,16 @@ use AbstractMigration; class DropOldStatusColumn extends AbstractMigration { function up($hesk_settings) { - $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `status`"); + // We no longer need to do this thanks to HESK 2.7.0 + //$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `status`"); } function down($hesk_settings) { - $ticketsRS = $this->executeQuery("SELECT `id`, `status_int` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets`;"); - while ($currentResult = hesk_dbFetchAssoc($ticketsRS)) { - - $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status_int` = '" . intval($currentResult['status']) . "' WHERE `id` = " . $currentResult['id']); - } + // We no longer need to do this thanks to HESK 2.7.0 + //$ticketsRS = $this->executeQuery("SELECT `id`, `status_int` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets`;"); + //while ($currentResult = hesk_dbFetchAssoc($ticketsRS)) { + // + // $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status_int` = '" . intval($currentResult['status_int']) . "' WHERE `id` = " . $currentResult['id']); + //} } } \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/MoveStatusesToNewColumn.php b/install/migrations/Pre140/Statuses/MoveStatusesToNewColumn.php index ce64aced..58037bec 100644 --- a/install/migrations/Pre140/Statuses/MoveStatusesToNewColumn.php +++ b/install/migrations/Pre140/Statuses/MoveStatusesToNewColumn.php @@ -7,14 +7,16 @@ use AbstractMigration; class MoveStatusesToNewColumn extends AbstractMigration { function up($hesk_settings) { - $ticketsRS = $this->executeQuery("SELECT `id`, `status` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets`;"); - while ($currentResult = hesk_dbFetchAssoc($ticketsRS)) { - - $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status_int` = " . $currentResult['status'] . " WHERE `id` = " . $currentResult['id']); - } + // We no longer need to do this thanks to HESK 2.7.0 + //$ticketsRS = $this->executeQuery("SELECT `id`, `status` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets`;"); + //while ($currentResult = hesk_dbFetchAssoc($ticketsRS)) { + // + // $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status_int` = " . $currentResult['status'] . " WHERE `id` = " . $currentResult['id']); + //} } function down($hesk_settings) { - $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` CHANGE COLUMN `status_int` `status` INT NOT NULL"); + // We no longer need to do this thanks to HESK 2.7.0 + //$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` CHANGE COLUMN `status_int` `status` INT NOT NULL"); } } \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/RenameTempColumn.php b/install/migrations/Pre140/Statuses/RenameTempColumn.php index d1eec50f..5695b798 100644 --- a/install/migrations/Pre140/Statuses/RenameTempColumn.php +++ b/install/migrations/Pre140/Statuses/RenameTempColumn.php @@ -6,10 +6,12 @@ namespace Pre140\Statuses; class RenameTempColumn extends \AbstractMigration { function up($hesk_settings) { - $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` CHANGE COLUMN `status_int` `status` INT NOT NULL"); + // We no longer need to do this thanks to HESK 2.7.0 + //$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` CHANGE COLUMN `status_int` `status` INT NOT NULL"); } function down($hesk_settings) { - $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `status`"); + // We no longer need to do this thanks to HESK 2.7.0 + //$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `status`"); } } \ No newline at end of file