Removed superfluous grandparent from entity query.
This commit is contained in:
parent
e4e0eb23dd
commit
63f43013c3
|
@ -133,7 +133,6 @@ async function fetchIncludedEntities() {
|
||||||
SELECT
|
SELECT
|
||||||
parents.*,
|
parents.*,
|
||||||
json_agg(included_entities ORDER BY included_entities.id) included_children,
|
json_agg(included_entities ORDER BY included_entities.id) included_children,
|
||||||
row_to_json(grandparents) AS parent,
|
|
||||||
(SELECT json_agg(children)
|
(SELECT json_agg(children)
|
||||||
FROM entities AS children
|
FROM entities AS children
|
||||||
WHERE children.parent_id = parents.id) children
|
WHERE children.parent_id = parents.id) children
|
||||||
|
@ -141,12 +140,10 @@ async function fetchIncludedEntities() {
|
||||||
included_entities
|
included_entities
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
entities AS parents ON parents.id = included_entities.parent_id
|
entities AS parents ON parents.id = included_entities.parent_id
|
||||||
LEFT JOIN
|
|
||||||
entities AS grandparents ON grandparents.id = parents.parent_id
|
|
||||||
WHERE
|
WHERE
|
||||||
included_entities.type = 'channel'
|
included_entities.type = 'channel'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
parents.id, grandparents.id
|
parents.id
|
||||||
), entity_tree as (
|
), entity_tree as (
|
||||||
/* get recursive parents of networks (necessary for scraper resolve) */
|
/* get recursive parents of networks (necessary for scraper resolve) */
|
||||||
SELECT to_jsonb(included_per_network) as entity,
|
SELECT to_jsonb(included_per_network) as entity,
|
||||||
|
|
Loading…
Reference in New Issue