Removed unnecessary depth calculation from entity query.
This commit is contained in:
parent
89a729924d
commit
e4e0eb23dd
|
@ -151,16 +151,14 @@ async function fetchIncludedEntities() {
|
||||||
/* 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,
|
||||||
parent_id,
|
parent_id,
|
||||||
array['parent'] as parent_path,
|
array['parent'] as parent_path
|
||||||
0 as depth
|
|
||||||
FROM included_per_network
|
FROM included_per_network
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)),
|
SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)),
|
||||||
entities.parent_id,
|
entities.parent_id,
|
||||||
entity_tree.parent_path || array['parent'],
|
entity_tree.parent_path || array['parent']
|
||||||
depth + 1
|
|
||||||
FROM entity_tree
|
FROM entity_tree
|
||||||
JOIN entities ON entity_tree.parent_id = entities.id
|
JOIN entities ON entity_tree.parent_id = entities.id
|
||||||
)
|
)
|
||||||
|
@ -185,8 +183,7 @@ async function fetchReleaseEntities(baseReleases) {
|
||||||
WITH RECURSIVE entity_tree as (
|
WITH RECURSIVE entity_tree as (
|
||||||
SELECT to_jsonb(entities) as entity,
|
SELECT to_jsonb(entities) as entity,
|
||||||
parent_id,
|
parent_id,
|
||||||
array['parent'] as parent_path,
|
array['parent'] as parent_path
|
||||||
0 as depth
|
|
||||||
FROM entities
|
FROM entities
|
||||||
WHERE slug = ANY(:entitySlugs)
|
WHERE slug = ANY(:entitySlugs)
|
||||||
|
|
||||||
|
@ -194,8 +191,7 @@ async function fetchReleaseEntities(baseReleases) {
|
||||||
|
|
||||||
SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)),
|
SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)),
|
||||||
entities.parent_id,
|
entities.parent_id,
|
||||||
entity_tree.parent_path || array['parent'],
|
entity_tree.parent_path || array['parent']
|
||||||
depth + 1
|
|
||||||
FROM entity_tree
|
FROM entity_tree
|
||||||
JOIN entities ON entity_tree.parent_id = entities.id
|
JOIN entities ON entity_tree.parent_id = entities.id
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue