Migrated some more SQL changes
parent
d29ec0374e
commit
2c8a4ad86e
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
abstract class AbstractUpdateMigration extends AbstractMigration {
|
|
||||||
abstract function getUpVersion();
|
|
||||||
|
|
||||||
abstract function getDownVersion();
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion($this->getUpVersion(), $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion($this->getDownVersion(), $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class UpdateMigration extends AbstractMigration {
|
||||||
|
private $upVersion;
|
||||||
|
private $downVersion;
|
||||||
|
|
||||||
|
public function __construct($upVersion, $downVersion) {
|
||||||
|
$this->upVersion = $upVersion;
|
||||||
|
$this->downVersion = $downVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->updateVersion($this->upVersion, $hesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->updateVersion($this->downVersion, $hesk_settings);
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v161;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('1.6.1', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('1.6.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v170;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('1.7.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('1.6.1', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v200;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('2.0.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('1.7.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v201;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('2.0.1', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('2.0.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v210;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('2.1.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('2.0.1', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v211;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('2.1.1', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('2.1.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v220;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('2.2.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('2.1.1', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v221;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractMigration {
|
|
||||||
|
|
||||||
function up($hesk_settings) {
|
|
||||||
$this->updateVersion('2.2.1', $hesk_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function down($hesk_settings) {
|
|
||||||
$this->updateVersion('2.2.0', $hesk_settings);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v230;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractUpdateMigration {
|
|
||||||
|
|
||||||
function getUpVersion() {
|
|
||||||
return '2.3.0';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDownVersion() {
|
|
||||||
return '2.2.1';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v231;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractUpdateMigration {
|
|
||||||
|
|
||||||
function getUpVersion() {
|
|
||||||
return '2.3.1';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDownVersion() {
|
|
||||||
return '2.3.0';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v232;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractUpdateMigration {
|
|
||||||
|
|
||||||
function getUpVersion() {
|
|
||||||
return '2.3.2';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDownVersion() {
|
|
||||||
return '2.3.1';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v240;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractUpdateMigration {
|
|
||||||
|
|
||||||
function getUpVersion() {
|
|
||||||
return '2.4.0';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDownVersion() {
|
|
||||||
return '2.3.2';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v241;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractUpdateMigration {
|
|
||||||
|
|
||||||
function getUpVersion() {
|
|
||||||
return '2.4.1';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDownVersion() {
|
|
||||||
return '2.4.0';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v242;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractUpdateMigration {
|
|
||||||
|
|
||||||
function getUpVersion() {
|
|
||||||
return '2.4.2';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDownVersion() {
|
|
||||||
return '2.4.1';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace v250;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateVersion extends \AbstractUpdateMigration {
|
|
||||||
|
|
||||||
function getUpVersion() {
|
|
||||||
return '2.5.0';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDownVersion() {
|
|
||||||
return '2.4.2';
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v260;
|
||||||
|
|
||||||
|
|
||||||
|
class AddApiTables extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('public_api', '0')");
|
||||||
|
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "user_api_tokens` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` INT NOT NULL,
|
||||||
|
`token` VARCHAR(500) NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'public_api'");
|
||||||
|
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "user_api_tokens`");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v260;
|
||||||
|
|
||||||
|
|
||||||
|
class AddCalendarModule extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`start` DATETIME,
|
||||||
|
`end` DATETIME,
|
||||||
|
`all_day` ENUM('0','1') NOT NULL,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`location` VARCHAR(255),
|
||||||
|
`comments` MEDIUMTEXT,
|
||||||
|
`category` INT NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` INT NOT NULL,
|
||||||
|
`event_id` INT NOT NULL,
|
||||||
|
`amount` INT NOT NULL,
|
||||||
|
`unit` INT NOT NULL,
|
||||||
|
`email_sent` ENUM('0', '1') NOT NULL DEFAULT '0') ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `due_date` DATETIME");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `usage` INT NOT NULL DEFAULT 0");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_overdue_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_calendar_view` INT NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('enable_calendar', '1')");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('first_day_of_week', '0')");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('default_calendar_view', 'month')");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event`");
|
||||||
|
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `due_date`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `overdue_email_sent`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `color`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `usage`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_overdue_unassigned`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_calendar_view`");
|
||||||
|
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'enable_calendar'");
|
||||||
|
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'first_day_of_week'");
|
||||||
|
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'default_calendar_view'");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v260;
|
||||||
|
|
||||||
|
|
||||||
|
class AddLoggingTable extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`username` VARCHAR(200),
|
||||||
|
`message` MEDIUMTEXT NOT NULL,
|
||||||
|
`severity` INT NOT NULL,
|
||||||
|
`location` MEDIUMTEXT,
|
||||||
|
`timestamp` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging`");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v260;
|
||||||
|
|
||||||
|
|
||||||
|
class AddPrimaryKeyToSettings extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` ADD PRIMARY KEY (`Key`)");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v260;
|
||||||
|
|
||||||
|
|
||||||
|
class AddTempAttachmentTable extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`file_name` VARCHAR(255) NOT NULL,
|
||||||
|
`saved_name` VARCHAR(255) NOT NULL,
|
||||||
|
`size` INT(10) UNSIGNED NOT NULL,
|
||||||
|
`type` ENUM('0','1') NOT NULL,
|
||||||
|
`date_uploaded` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment`");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v260;
|
||||||
|
|
||||||
|
|
||||||
|
class ConvertStatusPropertiesToInts extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` CHANGE `IsNewTicketStatus` `IsNewTicketStatus` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsClosed` `IsClosed` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsClosedByClient` `IsClosedByClient` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsCustomerReplyStatus` `IsCustomerReplyStatus` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsStaffClosedOption` `IsStaffClosedOption` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsStaffReopenedStatus` `IsStaffReopenedStatus` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsDefaultStaffReplyStatus` `IsDefaultStaffReplyStatus` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `LockedTicketStatus` `LockedTicketStatus` INT( 1 ) NOT NULL DEFAULT '0'");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` CHANGE `IsNewTicketStatus` `IsNewTicketStatus` INT( 1 ) NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsClosed` `IsClosed` ENUM('0','1') NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsClosedByClient` `IsClosedByClient` ENUM('0','1') NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsCustomerReplyStatus` `IsCustomerReplyStatus` ENUM('0','1') NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsStaffClosedOption` `IsStaffClosedOption` ENUM('0','1') NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsStaffReopenedStatus` `IsStaffReopenedStatus` ENUM('0','1') NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `IsDefaultStaffReplyStatus` `IsDefaultStaffReplyStatus` ENUM('0','1') NOT NULL DEFAULT '0',
|
||||||
|
CHANGE `LockedTicketStatus` `LockedTicketStatus` ENUM('0','1') NOT NULL DEFAULT '0'");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v262;
|
||||||
|
|
||||||
|
|
||||||
|
class AddMissingColumnsToStageTickets extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `due_date` DATETIME");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `due_date`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `overdue_email_sent`");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v300;
|
||||||
|
|
||||||
|
|
||||||
|
class AddColorSchemeSetting extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('admin_color_scheme', 'skin-blue')");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'admin_color_scheme'");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v300;
|
||||||
|
|
||||||
|
|
||||||
|
class MigrateAutorefreshOption extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `autoreload` = `autorefresh` / 10");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `autorefresh`");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `autorefresh` BIGINT NOT NULL DEFAULT 0");
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `autorefresh` = `autoreload` * 10");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v300;
|
||||||
|
|
||||||
|
|
||||||
|
class MigrateHeskCustomStatuses extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$hesk_statuses = $this->executeQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_statuses` ORDER BY `order`");
|
||||||
|
|
||||||
|
$next_status_id_rs = $this->executeQuery("SELECT MAX(`ID`) AS `last_id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`");
|
||||||
|
$next_status_id_row = hesk_dbFetchAssoc($next_status_id_rs);
|
||||||
|
$next_status_id = intval($next_status_id_row['last_id']) + 1;
|
||||||
|
|
||||||
|
$next_sort_rs = $this->executeQuery("SELECT MAX(`sort`) AS `last_sort` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`");
|
||||||
|
$next_sort_row = hesk_dbFetchAssoc($next_sort_rs);
|
||||||
|
$next_sort = intval($next_sort_row['last_sort']) + 10;
|
||||||
|
|
||||||
|
while ($row = hesk_dbFetchAssoc($hesk_statuses)) {
|
||||||
|
$closable = $row['can_customers_change'] == '1' ? 'yes' : 'sonly';
|
||||||
|
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (`ID`,
|
||||||
|
`TextColor`,
|
||||||
|
`IsNewTicketStatus`,
|
||||||
|
`IsClosed`,
|
||||||
|
`IsClosedByClient`,
|
||||||
|
`IsCustomerReplyStatus`,
|
||||||
|
`IsStaffClosedOption`,
|
||||||
|
`IsStaffReopenedStatus`,
|
||||||
|
`IsDefaultStaffReplyStatus`,
|
||||||
|
`LockedTicketStatus`,
|
||||||
|
`IsAutocloseOption`,
|
||||||
|
`Closable`,
|
||||||
|
`Key`,
|
||||||
|
`sort`)
|
||||||
|
VALUES (" . $next_status_id . ",
|
||||||
|
'#" . $row['color'] . "',
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
'" . $closable . "',
|
||||||
|
'STORED IN XREF TABLE',
|
||||||
|
" . $next_sort . ")");
|
||||||
|
|
||||||
|
$languages = json_decode($row['name']);
|
||||||
|
foreach ($languages as $language => $text) {
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (`language`, `text`, `status_id`)
|
||||||
|
VALUES ('" . $language . "', '" . $text . "', " . $next_status_id . ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increment the next ID and sort
|
||||||
|
$next_status_id++;
|
||||||
|
$next_sort += 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v302;
|
||||||
|
|
||||||
|
|
||||||
|
class AddMissingCustomFields extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets`
|
||||||
|
ADD COLUMN `custom21` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom22` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom23` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom24` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom25` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom26` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom27` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom28` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom29` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom30` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom31` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom32` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom33` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom34` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom35` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom36` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom37` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom38` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom39` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom40` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom41` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom42` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom43` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom44` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom45` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom46` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom47` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom48` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom49` MEDIUMTEXT,
|
||||||
|
ADD COLUMN `custom50` MEDIUMTEXT");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets`
|
||||||
|
DROP COLUMN `custom21`,
|
||||||
|
DROP COLUMN `custom22`,
|
||||||
|
DROP COLUMN `custom23`,
|
||||||
|
DROP COLUMN `custom24`,
|
||||||
|
DROP COLUMN `custom25`,
|
||||||
|
DROP COLUMN `custom26`,
|
||||||
|
DROP COLUMN `custom27`,
|
||||||
|
DROP COLUMN `custom28`,
|
||||||
|
DROP COLUMN `custom29`,
|
||||||
|
DROP COLUMN `custom30`,
|
||||||
|
DROP COLUMN `custom31`,
|
||||||
|
DROP COLUMN `custom32`,
|
||||||
|
DROP COLUMN `custom33`,
|
||||||
|
DROP COLUMN `custom34`,
|
||||||
|
DROP COLUMN `custom35`,
|
||||||
|
DROP COLUMN `custom36`,
|
||||||
|
DROP COLUMN `custom37`,
|
||||||
|
DROP COLUMN `custom38`,
|
||||||
|
DROP COLUMN `custom39`,
|
||||||
|
DROP COLUMN `custom40`,
|
||||||
|
DROP COLUMN `custom41`,
|
||||||
|
DROP COLUMN `custom42`,
|
||||||
|
DROP COLUMN `custom43`,
|
||||||
|
DROP COLUMN `custom44`,
|
||||||
|
DROP COLUMN `custom45`,
|
||||||
|
DROP COLUMN `custom46`,
|
||||||
|
DROP COLUMN `custom47`,
|
||||||
|
DROP COLUMN `custom48`,
|
||||||
|
DROP COLUMN `custom49`,
|
||||||
|
DROP COLUMN `custom50`");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue