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

Speed up the response -> message linking

parent 439cc7a5
Branches
Tags
No related merge requests found
...@@ -59,10 +59,13 @@ INSERT INTO `%TABLE_PREFIX%ticket_thread` ...@@ -59,10 +59,13 @@ 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`, `thread_type` SELECT `id`, `old_pk`
FROM `%TABLE_PREFIX%ticket_thread` FROM `%TABLE_PREFIX%ticket_thread`
WHERE `thread_type` = 'M'; WHERE `thread_type` = 'M';
-- Add an index to speed up the linking process
ALTER TABLE `%TABLE_PREFIX%T_resp_links` ADD KEY `old_pk` (`old_pk`, `id`);
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
WHERE `old_pid` = T2.`old_pk` ) WHERE `old_pid` = T2.`old_pk` )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment