Mods-for-HESK-Netsyms/install/migrations/v200/AddMissingKeyToTickets.php
2017-10-01 22:03:09 -04:00

19 lines
650 B
PHP

<?php
namespace v200;
class AddMissingKeyToTickets extends \AbstractMigration {
function up($hesk_settings) {
$keyRs = $this->executeQuery("SHOW KEYS FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE Key_name='statuses'");
if (hesk_dbNumRows($keyRs) == 0) {
//-- Add the key
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD KEY `statuses` (`status`)");
}
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP INDEX `statuses`");
}
}