mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-28 15:57:58 +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:
@@ -461,6 +461,7 @@
|
||||
9205|2022_09_03_fix_starting_point_heading.sql|SELECT * FROM db_version WHERE version >= 9205|empty|
|
||||
9206|2022_09_03_fix_door_destination_headings.sql|SELECT * FROM db_version WHERE version >= 9206|empty|
|
||||
9207|2022_09_03_fix_zone_point_heading_data.sql|SELECT * FROM db_version WHERE version >= 9207|empty|
|
||||
9208|2022_09_25_task_concat_matchlists.sql|SHOW COLUMNS FROM `task_activities` LIKE 'npc_id'|not_empty|
|
||||
|
||||
# Upgrade conditions:
|
||||
# This won't be needed after this system is implemented, but it is used database that are not
|
||||
|
||||
@@ -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