mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 12:18:27 +00:00
Combine task_activity item and npc fields
This will make tooling easier. While denormalizing goallists may not be ideal, it decouples tasks from rewards which share the table and removes a redundant column in favor of a using the delimited string which better matches live packet data.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
-- npc id
|
||||
UPDATE `task_activities`
|
||||
SET `task_activities`.`npc_match_list` = CONCAT_WS('|', `npc_match_list`, `npc_id`)
|
||||
WHERE npc_id != 0;
|
||||
|
||||
-- npc_goal_id goallists
|
||||
UPDATE `task_activities`
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT `goallists`.`listid`, GROUP_CONCAT(`goallists`.`entry` ORDER BY `goallists`.`entry` SEPARATOR '|') AS `goallist_ids`
|
||||
FROM `goallists`
|
||||
GROUP BY `goallists`.`listid`
|
||||
) AS `goallist_group`
|
||||
ON `task_activities`.`npc_goal_id` = `goallist_group`.`listid`
|
||||
SET `task_activities`.`npc_match_list` = CONCAT_WS('|', `npc_match_list`, `goallist_ids`)
|
||||
WHERE npc_goal_id != 0;
|
||||
|
||||
-- item id
|
||||
UPDATE `task_activities`
|
||||
SET `task_activities`.`item_id_list` = CONCAT_WS('|', `item_id_list`, `item_id`)
|
||||
WHERE item_id != 0;
|
||||
|
||||
-- item_goal_id goallists
|
||||
UPDATE `task_activities`
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT `goallists`.`listid`, GROUP_CONCAT(`goallists`.`entry` ORDER BY `goallists`.`entry` SEPARATOR '|') AS `goallist_ids`
|
||||
FROM `goallists`
|
||||
GROUP BY `goallists`.`listid`
|
||||
) AS `goallist_group`
|
||||
ON `task_activities`.`item_goal_id` = `goallist_group`.`listid`
|
||||
SET `task_activities`.`item_id_list` = CONCAT_WS('|', `item_id_list`, `goallist_ids`)
|
||||
WHERE item_goal_id != 0;
|
||||
|
||||
ALTER TABLE `task_activities`
|
||||
DROP COLUMN `npc_id`,
|
||||
DROP COLUMN `npc_goal_id`,
|
||||
DROP COLUMN `item_id`,
|
||||
DROP COLUMN `item_goal_id`;
|
||||
Reference in New Issue
Block a user