Skip to content
Snippets Groups Projects
Commit 7abd533f authored by Peter Rotich's avatar Peter Rotich
Browse files

Drop status column in favour of status_id

parent d26e8443
No related branches found
No related tags found
No related merge requests found
b38066879371ed792958b4ba9bc8de4a 03ff59bf35a58a102e9b32ad33c2839f
DELETE FROM `%TABLE_PREFIX%config`
WHERE `namespace`='core' AND `key` = 'random_ticket_ids';
ALTER TABLE `%TABLE_PREFIX%ticket`
DROP COLUMN `status`;
OPTIMIZE TABLE `%TABLE_PREFIX%ticket`;
/** /**
* @version v1.9.4 * @version v1.9.4
* @signature b38066879371ed792958b4ba9bc8de4a * @signature 03ff59bf35a58a102e9b32ad33c2839f
* @title Custom Ticket Numbers and Statuses * @title Custom Ticket Numbers and Statuses
* *
* This patch adds support for ticket number sequences to the database * This patch adds support for ticket number sequences to the database
...@@ -26,21 +26,18 @@ CREATE TABLE `%TABLE_PREFIX%sequence` ( ...@@ -26,21 +26,18 @@ CREATE TABLE `%TABLE_PREFIX%sequence` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET @random = (SELECT `value` FROM `%TABLE_PREFIX%config` SET @random = (SELECT `value` FROM `%TABLE_PREFIX%config`
WHERE `namespace` = 'core' AND `key` = 'use_random_ids'); WHERE `namespace` = 'core' AND `key` = 'random_ticket_ids');
-- Sequence (id=1) will be loaded in the task file -- Sequence (id=1) will be loaded in the task file
INSERT INTO `%TABLE_PREFIX%config` (`namespace`, `key`, `value`) INSERT INTO `%TABLE_PREFIX%config` (`namespace`, `key`, `value`)
VALUES VALUES
('core', 'number_format', CASE WHEN @random THEN '######' ELSE '#' END), ('core', 'number_format', IF(@random, '######', '#')),
('core', 'sequence_id', CASE WHEN @random THEN 0 ELSE 1 END); ('core', 'sequence_id', IF(@random, 0, 1));
DELETE FROM `%TABLE_PREFIX%config`
WHERE `namespace`='core' AND `key` = 'use_random_ids';
ALTER TABLE `%TABLE_PREFIX%help_topic` ALTER TABLE `%TABLE_PREFIX%help_topic`
ADD `flags` int(10) unsigned DEFAULT '0' AFTER `noautoresp`, ADD `flags` int(10) unsigned DEFAULT '0' AFTER `noautoresp`,
ADD `sequence_id` int(10) unsigned NOT NULL DEFAULT '0' AFTER `form_id`, ADD `sequence_id` int(10) unsigned NOT NULL DEFAULT '0' AFTER `form_id`,
ADD `number_format` varchar(32) DEFAULT NULL AFTER `topic`; ADD `number_format` varchar(32) DEFAULT NULL AFTER `topic`;
ALTER TABLE `%TABLE_PREFIX%list` ALTER TABLE `%TABLE_PREFIX%list`
ADD `masks` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `sort_mode`, ADD `masks` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `sort_mode`,
...@@ -50,9 +47,9 @@ ALTER TABLE `%TABLE_PREFIX%list` ...@@ -50,9 +47,9 @@ ALTER TABLE `%TABLE_PREFIX%list`
CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%ticket_status` ( CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%ticket_status` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(60) NOT NULL DEFAULT '', `name` varchar(60) NOT NULL DEFAULT '',
`state` varchar(16) NOT NULL DEFAULT 'open', `state` varchar(16) DEFAULT NULL,
`mode` int(11) unsigned NOT NULL DEFAULT '0', `mode` int(11) unsigned NOT NULL DEFAULT '0',
`flags` int(10) unsigned NOT NULL DEFAULT '0', `flags` int(11) unsigned NOT NULL DEFAULT '0',
`sort` int(11) unsigned NOT NULL DEFAULT '0', `sort` int(11) unsigned NOT NULL DEFAULT '0',
`notes` text NOT NULL, `notes` text NOT NULL,
`created` datetime NOT NULL, `created` datetime NOT NULL,
...@@ -72,7 +69,13 @@ ALTER TABLE `%TABLE_PREFIX%ticket` ...@@ -72,7 +69,13 @@ ALTER TABLE `%TABLE_PREFIX%ticket`
ADD `status_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `user_email_id`, ADD `status_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `user_email_id`,
ADD INDEX (`status_id`); ADD INDEX (`status_id`);
UPDATE `%TABLE_PREFIX%ticket` SET `status_id` = 3
WHERE `status` = 'closed';
UPDATE `%TABLE_PREFIX%ticket` SET `status_id` = 1
WHERE `status` = 'open';
-- Finished with patch -- Finished with patch
UPDATE `%TABLE_PREFIX%config` UPDATE `%TABLE_PREFIX%config`
SET `value` = 'b38066879371ed792958b4ba9bc8de4a' SET `value` = '03ff59bf35a58a102e9b32ad33c2839f'
WHERE `key` = 'schema_signature' AND `namespace` = 'core'; WHERE `key` = 'schema_signature' AND `namespace` = 'core';
...@@ -599,7 +599,6 @@ CREATE TABLE `%TABLE_PREFIX%ticket` ( ...@@ -599,7 +599,6 @@ CREATE TABLE `%TABLE_PREFIX%ticket` (
`email_id` int(11) unsigned NOT NULL default '0', `email_id` int(11) unsigned NOT NULL default '0',
`flags` int(10) unsigned NOT NULL default '0', `flags` int(10) unsigned NOT NULL default '0',
`ip_address` varchar(64) NOT NULL default '', `ip_address` varchar(64) NOT NULL default '',
`status` enum('open','closed') NOT NULL default 'open',
`source` enum('Web','Email','Phone','API','Other') NOT NULL default 'Other', `source` enum('Web','Email','Phone','API','Other') NOT NULL default 'Other',
`isoverdue` tinyint(1) unsigned NOT NULL default '0', `isoverdue` tinyint(1) unsigned NOT NULL default '0',
`isanswered` tinyint(1) unsigned NOT NULL default '0', `isanswered` tinyint(1) unsigned NOT NULL default '0',
...@@ -614,7 +613,6 @@ CREATE TABLE `%TABLE_PREFIX%ticket` ( ...@@ -614,7 +613,6 @@ CREATE TABLE `%TABLE_PREFIX%ticket` (
KEY `user_id` (`user_id`), KEY `user_id` (`user_id`),
KEY `dept_id` (`dept_id`), KEY `dept_id` (`dept_id`),
KEY `staff_id` (`staff_id`), KEY `staff_id` (`staff_id`),
KEY `status` (`status`),
KEY `team_id` (`team_id`), KEY `team_id` (`team_id`),
KEY `status_id` (`status_id`), KEY `status_id` (`status_id`),
KEY `created` (`created`), KEY `created` (`created`),
...@@ -679,9 +677,9 @@ DROP TABLE IF EXISTS `%TABLE_PREFIX%ticket_status`; ...@@ -679,9 +677,9 @@ DROP TABLE IF EXISTS `%TABLE_PREFIX%ticket_status`;
CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%ticket_status` ( CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%ticket_status` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(60) NOT NULL DEFAULT '', `name` varchar(60) NOT NULL DEFAULT '',
`state` varchar(16) NOT NULL DEFAULT 'open', `state` varchar(16) DEFAULT NULL,
`mode` int(11) unsigned NOT NULL DEFAULT '0', `mode` int(11) unsigned NOT NULL DEFAULT '0',
`flags` int(10) unsigned NOT NULL DEFAULT '0', `flags` int(11) unsigned NOT NULL DEFAULT '0',
`sort` int(11) unsigned NOT NULL DEFAULT '0', `sort` int(11) unsigned NOT NULL DEFAULT '0',
`notes` text NOT NULL, `notes` text NOT NULL,
`created` datetime NOT NULL, `created` datetime NOT NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment