Working on creating the migrations
parent
6ea38bc90b
commit
92713506e6
@ -1,7 +1,47 @@
|
||||
<?php
|
||||
|
||||
abstract class AbstractMigration {
|
||||
abstract function up();
|
||||
abstract function up($hesk_settings);
|
||||
|
||||
abstract function down();
|
||||
abstract function down($hesk_settings);
|
||||
|
||||
function executeQuery($sql)
|
||||
{
|
||||
global $hesk_last_query;
|
||||
global $hesk_db_link;
|
||||
if (function_exists('mysqli_connect')) {
|
||||
|
||||
if (!$hesk_db_link && !hesk_dbConnect()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$hesk_last_query = $sql;
|
||||
|
||||
if ($res = @mysqli_query($hesk_db_link, $sql)) {
|
||||
return $res;
|
||||
} else {
|
||||
http_response_code(500);
|
||||
print "Could not execute query: $sql. MySQL said: " . mysqli_error($hesk_db_link);
|
||||
die();
|
||||
}
|
||||
} else {
|
||||
if (!$hesk_db_link && !hesk_dbConnect()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$hesk_last_query = $sql;
|
||||
|
||||
if ($res = @mysql_query($sql, $hesk_db_link)) {
|
||||
return $res;
|
||||
} else {
|
||||
http_response_code(500);
|
||||
print "Could not execute query: $sql. MySQL said: " . mysql_error();
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateVersion($version, $hesk_settings) {
|
||||
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '{$version}' WHERE `Key` = 'modsForHeskVersion'");
|
||||
}
|
||||
}
|
@ -1,9 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Pre140\StatusesMigration;
|
||||
|
||||
function getAllMigrations() {
|
||||
return array(
|
||||
1 => new StatusesMigration()
|
||||
1 => new \Pre140\StatusesMigration(),
|
||||
//1.4.0
|
||||
2 => new \v140\AddAutorefreshColumn(),
|
||||
3 => new \v140\AddDeniedIpsTable(),
|
||||
//1.4.1
|
||||
4 => new \v141\AddDeniedEmailsTable(),
|
||||
5 => new \v141\AddTicketParentColumn(),
|
||||
//1.5.0
|
||||
6 => new \v150\AddActiveColumnToUser(),
|
||||
7 => new \v150\AddCanManSettingsPermissionToUser(),
|
||||
8 => new \v150\AddDefaultNotifyCustomerEmailPreference(),
|
||||
//1.6.0
|
||||
9 => new \v160\AddNotifyNoteUnassignedProperty(),
|
||||
10 => new \v160\AddCanChangeNotificationSettingsPermission(),
|
||||
11 => new \v160\AddEditInfoToNotes(),
|
||||
12 => new \v160\AddNoteIdToAttachments(),
|
||||
13 => new \v160\ModifyTicketIdOnAttachments(),
|
||||
14 => new \v160\CreateSettingsTable(),
|
||||
15 => new \v160\InsertVersionRecord(),
|
||||
//1.6.1
|
||||
16 => new \v161\UpdateVersion(),
|
||||
//1.7.0
|
||||
17 => new \v170\CreateVerifiedEmailsTable(),
|
||||
18 => new \v170\CreatePendingVerificationEmailsTable(),
|
||||
19 => new \v170\CreateStageTicketsTable(),
|
||||
20 => new \v170\UpdateVersion(),
|
||||
//2.0.0
|
||||
21 => new \v200\RemoveNoteIdFromAttachments(),
|
||||
22 => new \v200\RemoveEditInfoFromNotes(),
|
||||
23 => new \v200\RemoveDefaultNotifyCustomerEmailPreference(),
|
||||
24 => new \v200\AddMissingKeyToTickets(),
|
||||
25 => new \v200\UpdateVersion(),
|
||||
|
||||
);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace v140;
|
||||
|
||||
use AbstractMigration;
|
||||
|
||||
class AddAutorefreshColumn extends AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `autorefresh` BIGINT NOT NULL DEFAULT 0 AFTER `replies`;");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `autorefresh`;");
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace v140;
|
||||
|
||||
|
||||
class AddDeniedIpsTable extends \AbstractMigration {
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips` (
|
||||
`ID` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`RangeStart` VARCHAR(100) NOT NULL,
|
||||
`RangeEnd` VARCHAR(100) NOT NULL)");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`");
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace v141;
|
||||
|
||||
class AddDeniedEmailsTable extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails` (
|
||||
ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
Email VARCHAR(100) NOT NULL);");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v141;
|
||||
|
||||
|
||||
class AddTicketParentColumn extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `parent` MEDIUMINT(8) NULL AFTER `custom20`;");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `parent`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v150;
|
||||
|
||||
|
||||
class AddActiveColumnToUser extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `active` ENUM('0', '1') NOT NULL DEFAULT '1'");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `active`");
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace v150;
|
||||
|
||||
|
||||
class AddCanManSettingsPermissionToUser extends \AbstractMigration {
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_manage_settings` ENUM('0', '1') NOT NULL DEFAULT '1'");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_manage_settings`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v150;
|
||||
|
||||
|
||||
class AddDefaultNotifyCustomerEmailPreference extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_notify_customer_email` ENUM ('0', '1') NOT NULL DEFAULT '1'");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_notify_customer_email`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v160;
|
||||
|
||||
|
||||
class AddCanChangeNotificationSettingsPermission extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_change_notification_settings` ENUM('0', '1') NOT NULL DEFAULT '1'");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_change_notification_settings`");
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace v160;
|
||||
|
||||
|
||||
class AddEditInfoToNotes extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `edit_date` DATETIME NULL");
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `number_of_edits` INT NOT NULL DEFAULT 0");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `edit_date`");
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `number_of_edits`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v160;
|
||||
|
||||
|
||||
class AddNoteIdToAttachments extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` ADD COLUMN `note_id` INT NULL AFTER `ticket_id`");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` DROP COLUMN `note_id`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v160;
|
||||
|
||||
|
||||
class AddNotifyNoteUnassignedProperty extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_note_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0'");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_note_unassigned`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v160;
|
||||
|
||||
|
||||
class CreateSettingsTable extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key` NVARCHAR(200) NOT NULL, `Value` NVARCHAR(200) NOT NULL)");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v160;
|
||||
|
||||
|
||||
class InsertVersionRecord extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('modsForHeskVersion', '1.6.0')");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'modsForHeskVersion'");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v160;
|
||||
|
||||
|
||||
class ModifyTicketIdOnAttachments extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` MODIFY COLUMN `ticket_id` VARCHAR(13) NULL");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` MODIFY COLUMN `ticket_id` VARCHAR(13) NOT NULL DEFAULT ''");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v170;
|
||||
|
||||
|
||||
class CreatePendingVerificationEmailsTable extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "pending_verification_emails` (`Email` VARCHAR(255) NOT NULL, `ActivationKey` VARCHAR(500) NOT NULL)");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "pending_verification_emails`");
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace v170;
|
||||
|
||||
|
||||
class CreateStageTicketsTable extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`trackid` varchar(13) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
||||
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
||||
`category` smallint(5) unsigned NOT NULL DEFAULT '1',
|
||||
`priority` enum('0','1','2','3') COLLATE utf8_unicode_ci NOT NULL DEFAULT '3',
|
||||
`subject` varchar(70) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
||||
`message` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`dt` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00',
|
||||
`lastchange` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`ip` varchar(46) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
||||
`language` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`status` int(11) NOT NULL DEFAULT '0',
|
||||
`owner` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`time_worked` time NOT NULL DEFAULT '00:00:00',
|
||||
`lastreplier` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
|
||||
`replierid` smallint(5) unsigned DEFAULT NULL,
|
||||
`archive` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
|
||||
`locked` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
|
||||
`attachments` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`merged` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`history` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom1` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom2` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom3` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom4` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom5` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom6` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom7` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom8` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom9` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom10` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom11` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom12` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom13` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom14` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom15` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom16` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom17` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom18` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom19` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`custom20` mediumtext COLLATE utf8_unicode_ci NOT NULL,
|
||||
`parent` mediumint(8) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `trackid` (`trackid`),
|
||||
KEY `archive` (`archive`),
|
||||
KEY `categories` (`category`),
|
||||
KEY `statuses` (`status`),
|
||||
KEY `owner` (`owner`)
|
||||
)");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v170;
|
||||
|
||||
class CreateVerifiedEmailsTable extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "verified_emails` (`Email` VARCHAR(255) NOT NULL)");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "verified_emails`");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?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`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v200;
|
||||
|
||||
|
||||
class RemoveDefaultNotifyCustomerEmailPreference extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_notify_customer_email`");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_notify_customer_email` ENUM ('0', '1') NOT NULL DEFAULT '1'");
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace v200;
|
||||
|
||||
|
||||
class RemoveEditInfoFromNotes extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `edit_date`");
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `number_of_edits`");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `edit_date` DATETIME NULL");
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `number_of_edits` INT NOT NULL DEFAULT 0");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace v200;
|
||||
|
||||
|
||||
class RemoveNoteIdFromAttachments extends \AbstractMigration {
|
||||
|
||||
function up($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` DROP COLUMN `note_id`");
|
||||
}
|
||||
|
||||
function down($hesk_settings) {
|
||||
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` ADD COLUMN `note_id` INT NULL AFTER `ticket_id`");
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue