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

Properly migrate to ticket thread

Add a (temporary) key to %ticket_thread allowing quick lookups on the old_pk
column. Also, only fill the temporary table used for linking responses to
the migrated messages with messages.
parent 902fd616
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ CREATE TABLE `%TABLE_PREFIX%ticket_thread` ( ...@@ -28,6 +28,7 @@ CREATE TABLE `%TABLE_PREFIX%ticket_thread` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `ticket_id` (`ticket_id`), KEY `ticket_id` (`ticket_id`),
KEY `staff_id` (`staff_id`), KEY `staff_id` (`staff_id`),
KEY `old_pk` (`old_pk`),
FULLTEXT KEY `body` (`body`) FULLTEXT KEY `body` (`body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
...@@ -57,7 +58,9 @@ INSERT INTO `%TABLE_PREFIX%ticket_thread` ...@@ -57,7 +58,9 @@ INSERT INTO `%TABLE_PREFIX%ticket_thread`
-- Connect responses to (new) messages -- Connect responses to (new) messages
CREATE TABLE `%TABLE_PREFIX%T_resp_links` CREATE TABLE `%TABLE_PREFIX%T_resp_links`
SELECT `id`, `old_pk`, `old_pid` FROM `%TABLE_PREFIX%ticket_thread`; SELECT `id`, `old_pk`, `old_pid`, `thread_type`
FROM `%TABLE_PREFIX%ticket_thread`
WHERE `thread_type` = 'M';
UPDATE `%TABLE_PREFIX%ticket_thread` UPDATE `%TABLE_PREFIX%ticket_thread`
SET `pid` = ( SELECT T2.`id` FROM `%TABLE_PREFIX%T_resp_links` T2 SET `pid` = ( SELECT T2.`id` FROM `%TABLE_PREFIX%T_resp_links` T2
......
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