Skip to content
Snippets Groups Projects
Commit c581a338 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #1318 from protich/issue/1316


bug: Add ticket status properties field exist before loading initial data

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents d3fff36b 6268c338
No related branches found
No related tags found
No related merge requests found
...@@ -4,4 +4,7 @@ DELETE FROM `%TABLE_PREFIX%config` ...@@ -4,4 +4,7 @@ DELETE FROM `%TABLE_PREFIX%config`
DELETE FROM `%TABLE_PREFIX%ticket_status` DELETE FROM `%TABLE_PREFIX%ticket_status`
WHERE `state` = 'resolved'; WHERE `state` = 'resolved';
ALTER TABLE `%TABLE_PREFIX%ticket_status`
DROP `notes`;
OPTIMIZE TABLE `%TABLE_PREFIX%ticket_status`; OPTIMIZE TABLE `%TABLE_PREFIX%ticket_status`;
...@@ -18,10 +18,19 @@ UPDATE `%TABLE_PREFIX%ticket` t1 ...@@ -18,10 +18,19 @@ UPDATE `%TABLE_PREFIX%ticket` t1
SET t1.status_id = @statusId SET t1.status_id = @statusId
WHERE t2.state='resolved'; WHERE t2.state='resolved';
-- add properties field -- add properties field IF it doesn't exist
ALTER TABLE `%TABLE_PREFIX%ticket_status` SET @s = (SELECT IF(
ADD `properties` TEXT NOT NULL AFTER `sort`, (SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = '%TABLE_PREFIX%ticket_status'
AND table_schema = DATABASE()
AND column_name = 'properties'
) > 0,
"SELECT 1",
"ALTER TABLE `%TABLE_PREFIX%ticket_status` ADD `properties` text NOT NULL AFTER `sort`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
UPDATE `%TABLE_PREFIX%ticket_status` s UPDATE `%TABLE_PREFIX%ticket_status` s
INNER JOIN `ost_config` c INNER JOIN `ost_config` c
......
...@@ -51,6 +51,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%ticket_status` ( ...@@ -51,6 +51,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%ticket_status` (
`mode` int(11) unsigned NOT NULL DEFAULT '0', `mode` int(11) unsigned NOT NULL DEFAULT '0',
`flags` int(11) 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',
`properties` text NOT NULL,
`notes` text NOT NULL, `notes` text NOT NULL,
`created` datetime NOT NULL, `created` datetime NOT NULL,
`updated` datetime NOT NULL, `updated` datetime NOT NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment