Refactored some more migrations

master
Mike Koch 7 years ago
parent 62d9f31d14
commit fed59f988f
No known key found for this signature in database
GPG Key ID: 9BA5D7F8391455ED

@ -28,10 +28,10 @@ if (hesk_dbNumRows($tableSql) > 0) {
$migration_map = array(
// Pre-1.4.0 to 1.5.0 did not have a settings table
'1.6.0' => 22, '1.6.1' => 23, '1.7.0' => 27, '2.0.0' => 37, '2.0.1' => 38, '2.1.0' => 39, '2.1.1' => 42,
'2.2.0' => 47, '2.2.1' => 48, '2.3.0' => 68, '2.3.1' => 69, '2.3.2' => 70, '2.4.0' => 86, '2.4.1' => 87,
'2.4.2' => 88, /*TODO*/ '2.5.0' => 54, '2.5.1' => 55, '2.5.2' => 56, '2.5.3' => 57, '2.5.4' => 58, '2.5.5' => 59,
'2.6.0' => 66, '2.6.1' => 67, '2.6.2' => 69, '2.6.3' => 70, '2.6.4' => 71, '3.0.0' => 75, '3.0.1' => 76,
'1.6.0' => 22, '1.6.1' => 23, '1.7.0' => 27, '2.0.0' => 37, '2.0.1' => 38, '2.1.0' => 39, '2.1.1' => 42,
'2.2.0' => 47, '2.2.1' => 48, '2.3.0' => 68, '2.3.1' => 69, '2.3.2' => 70, '2.4.0' => 86, '2.4.1' => 87,
'2.4.2' => 88, '2.5.0' => 98, '2.5.1' => 99, '2.5.2' => 100, '2.5.3' => 101, '2.5.4' => 102, '2.5.5' => 103,
'2.6.0' => 121, '2.6.1' => 122, '2.6.2' => 125, '2.6.3' => 126, '2.6.4' => 127, /*TODO*/ '3.0.0' => 75, '3.0.1' => 76,
'3.0.2' => 78, '3.0.3' => 79, '3.0.4' => 80, '3.0.5' => 81, '3.0.6' => 82, '3.0.7' => 83, '3.1.0' => 90,
'3.1.1' => 91
);

@ -124,40 +124,58 @@ function getAllMigrations() {
//2.4.2
87 => new LegacyUpdateMigration('2.4.2', '2.4.1'),
//2.5.0
// TODO
51 => new \v250\MigrateSettingsToDatabase(),
52 => new \v250\AddUserAgentAndScreenResToTickets(),
53 => new \v250\AddNavbarTitleUrl(),
54 => new LegacyUpdateMigration('2.5.0', '2.4.2'),
88 => new \v250\MigrateSettingsToDatabase(),
89 => new \v250\AddUserAgentAndScreenResToTickets\AddUserAgentToTickets(),
90 => new \v250\AddUserAgentAndScreenResToTickets\AddUserAgentToStageTickets(),
91 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResWidthToTickets(),
92 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResHeightToTickets(),
93 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResWidthToStageTickets(),
94 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResHeightToStageTickets(),
95 => new \v250\AddUserAgentAndScreenResToTickets\InsertSetting(),
96 => new \v250\AddNavbarTitleUrl(),
97 => new LegacyUpdateMigration('2.5.0', '2.4.2'),
//2.5.1
55 => new LegacyUpdateMigration('2.5.1', '2.5.0'),
98 => new LegacyUpdateMigration('2.5.1', '2.5.0'),
//2.5.2
56 => new LegacyUpdateMigration('2.5.2', '2.5.1'),
99 => new LegacyUpdateMigration('2.5.2', '2.5.1'),
//2.5.3
57 => new LegacyUpdateMigration('2.5.3', '2.5.2'),
100 => new LegacyUpdateMigration('2.5.3', '2.5.2'),
//2.5.4
58 => new LegacyUpdateMigration('2.5.4', '2.5.3'),
101 => new LegacyUpdateMigration('2.5.4', '2.5.3'),
//2.5.5
59 => new LegacyUpdateMigration('2.5.5', '2.5.4'),
102 => new LegacyUpdateMigration('2.5.5', '2.5.4'),
//2.6.0
60 => new \v260\AddApiTables(),
61 => new \v260\AddLoggingTable(),
62 => new \v260\AddTempAttachmentTable(),
63 => new \v260\AddCalendarModule(),
64 => new \v260\AddPrimaryKeyToSettings(),
65 => new \v260\ConvertStatusPropertiesToInts(),
66 => new LegacyUpdateMigration('2.6.0', '2.5.5'),
103 => new \v260\AddApiTables\CreateTable(),
104 => new \v260\AddApiTables\InsertSetting(),
105 => new \v260\AddLoggingTable(),
106 => new \v260\AddTempAttachmentTable(),
107 => new \v260\AddCalendarModule\CreateCalendarEventTable(),
108 => new \v260\AddCalendarModule\CreateCalendarEventReminderTable(),
109 => new \v260\AddCalendarModule\AddDueDateColumnToTickets(),
110 => new \v260\AddCalendarModule\AddOverdueEmailSentColumnToTickets(),
111 => new \v260\AddCalendarModule\AddColorColumnToCategories(),
112 => new \v260\AddCalendarModule\AddUsageColumnToCategories(),
113 => new \v260\AddCalendarModule\AddNotifyOverdueUnassignedColumnToUsers(),
114 => new \v260\AddCalendarModule\AddDefaultCalendarViewToUsers(),
115 => new \v260\AddCalendarModule\InsertEnableCalendarSetting(),
116 => new \v260\AddCalendarModule\InsertFirstDayOfWeekSetting(),
117 => new \v260\AddCalendarModule\InsertDefaultCalendarViewSetting(),
118 => new \v260\AddPrimaryKeyToSettings(),
119 => new \v260\ConvertStatusPropertiesToInts(),
120 => new LegacyUpdateMigration('2.6.0', '2.5.5'),
//2.6.1
67 => new LegacyUpdateMigration('2.6.1', '2.6.0'),
121 => new LegacyUpdateMigration('2.6.1', '2.6.0'),
//2.6.2
68 => new \v262\AddMissingColumnsToStageTickets(),
69 => new LegacyUpdateMigration('2.6.2', '2.6.1'),
122 => new \v262\AddMissingColumnsToStageTickets\AddDueDateColumn(),
123 => new \v262\AddMissingColumnsToStageTickets\AddOverdueEmailSentColumn(),
124 => new LegacyUpdateMigration('2.6.2', '2.6.1'),
//2.6.3
70 => new LegacyUpdateMigration('2.6.3', '2.6.2'),
125 => new LegacyUpdateMigration('2.6.3', '2.6.2'),
//2.6.4
71 => new LegacyUpdateMigration('2.6.4', '2.6.3'),
126 => new LegacyUpdateMigration('2.6.4', '2.6.3'),
//3.0.0
72 => new \v300\MigrateHeskCustomStatuses(),
127 => new \v300\MigrateHeskCustomStatuses(),
// TODO
73 => new \v300\MigrateAutorefreshOption(),
74 => new \v300\AddColorSchemeSetting(),
75 => new LegacyUpdateMigration('3.0.0', '2.6.4'),

@ -0,0 +1,15 @@
<?php
namespace v250\AddUserAgentAndScreenResToTickets;
class AddScreenResHeightToStageTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `screen_resolution_height` INT");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `screen_resolution_height`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v250\AddUserAgentAndScreenResToTickets;
class AddScreenResHeightToTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `screen_resolution_height` INT");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `screen_resolution_height`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v250\AddUserAgentAndScreenResToTickets;
class AddScreenResWidthToStageTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `screen_resolution_width` INT");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `screen_resolution_width`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v250\AddUserAgentAndScreenResToTickets;
class AddScreenResWidthToTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `screen_resolution_width` INT");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `screen_resolution_width`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v250\AddUserAgentAndScreenResToTickets;
class AddUserAgentToStageTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `user_agent` TEXT");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `user_agent`");
}
}

@ -1,9 +1,9 @@
<?php
namespace v250;
namespace v250\AddUserAgentAndScreenResToTickets;
class AddUserAgentAndScreenResToTickets extends \AbstractMigration {
class AddUserAgentToTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `user_agent` TEXT");

@ -0,0 +1,15 @@
<?php
namespace v250\AddUserAgentAndScreenResToTickets;
class InsertSetting extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('display_user_agent_information', '0')");
}
function down($hesk_settings) {
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'display_user_agent_information'");
}
}

@ -1,12 +1,11 @@
<?php
namespace v260;
namespace v260\AddApiTables;
class AddApiTables extends \AbstractMigration {
class CreateTable 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,
@ -14,7 +13,6 @@ class AddApiTables extends \AbstractMigration {
}
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,15 @@
<?php
namespace v260\AddApiTables;
class InsertSetting extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('public_api', '0')");
}
function down($hesk_settings) {
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'public_api'");
}
}

@ -1,49 +0,0 @@
<?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,15 @@
<?php
namespace v260\AddCalendarModule;
class AddColorColumnToCategories extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `color`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class AddDefaultCalendarViewToUsers extends \AbstractMigration {
function up($hesk_settings) {
$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`");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_calendar_view`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class AddDueDateColumnToTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `due_date` DATETIME");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `due_date`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class AddNotifyOverdueUnassignedColumnToUsers extends \AbstractMigration {
function up($hesk_settings) {
$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`");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_overdue_unassigned`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class AddOverdueEmailSentColumnToTickets extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `overdue_email_sent`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class AddUsageColumnToCategories extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `usage` INT NOT NULL DEFAULT 0");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `usage`");
}
}

@ -0,0 +1,21 @@
<?php
namespace v260\AddCalendarModule;
class CreateCalendarEventReminderTable extends \AbstractMigration {
function up($hesk_settings) {
$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");
}
function down($hesk_settings) {
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder`");
}
}

@ -0,0 +1,23 @@
<?php
namespace v260\AddCalendarModule;
class CreateCalendarEventTable 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");
}
function down($hesk_settings) {
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event`");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class InsertDefaultCalendarViewSetting extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('default_calendar_view', 'month')");
}
function down($hesk_settings) {
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'default_calendar_view'");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class InsertEnableCalendarSetting extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('enable_calendar', '1')");
}
function down($hesk_settings) {
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'enable_calendar'");
}
}

@ -0,0 +1,15 @@
<?php
namespace v260\AddCalendarModule;
class InsertFirstDayOfWeekSetting extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('first_day_of_week', '0')");
}
function down($hesk_settings) {
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'first_day_of_week'");
}
}

@ -10,5 +10,6 @@ class AddPrimaryKeyToSettings extends \AbstractMigration {
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` DROP PRIMARY KEY");
}
}

@ -0,0 +1,15 @@
<?php
namespace v262\AddMissingColumnsToStageTickets;
class AddDueDateColumn extends \AbstractMigration {
function up($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `due_date` DATETIME");
}
function down($hesk_settings) {
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `due_date`");
}
}

@ -1,17 +1,15 @@
<?php
namespace v262;
namespace v262\AddMissingColumnsToStageTickets;
class AddMissingColumnsToStageTickets extends \AbstractMigration {
class AddOverdueEmailSentColumn 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`");
}
}
Loading…
Cancel
Save