Use LEFT OUTER JOIN to not skip mods in the dump

This commit is contained in:
Tyler Hallada 2022-01-24 22:46:23 -05:00
parent 0c3d85d697
commit 4875d2d764

View File

@ -331,8 +331,8 @@ pub async fn batched_get_with_cells(
mods.*, mods.*,
COALESCE(json_agg(DISTINCT jsonb_build_object('x', cells.x, 'y', cells.y)) FILTER (WHERE cells.x IS NOT NULL AND cells.y IS NOT NULL), '[]') AS cells COALESCE(json_agg(DISTINCT jsonb_build_object('x', cells.x, 'y', cells.y)) FILTER (WHERE cells.x IS NOT NULL AND cells.y IS NOT NULL), '[]') AS cells
FROM mods FROM mods
JOIN plugin_cells ON plugin_cells.mod_id = mods.id LEFT OUTER JOIN plugin_cells ON plugin_cells.mod_id = mods.id
JOIN cells ON cells.id = plugin_cells.cell_id LEFT OUTER JOIN cells ON cells.id = plugin_cells.cell_id
WHERE mods.id > $2 WHERE mods.id > $2
GROUP BY mods.id GROUP BY mods.id
ORDER BY mods.id ASC ORDER BY mods.id ASC