You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
750 B
PHTML
20 lines
750 B
PHTML
7 years ago
|
<?php
|
||
|
|
||
|
namespace Pre140\Statuses;
|
||
|
|
||
|
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']);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function down($hesk_settings) {
|
||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` CHANGE COLUMN `status_int` `status` INT NOT NULL");
|
||
|
}
|
||
|
}
|