diff --git a/crates/manager-core/src/apply_service.rs b/crates/manager-core/src/apply_service.rs index 194df18..8e1f308 100644 --- a/crates/manager-core/src/apply_service.rs +++ b/crates/manager-core/src/apply_service.rs @@ -2739,9 +2739,10 @@ impl ApplyService { // `exclude` (the planning project) or by nothing are dropped. let rows: Vec<(String, i64)> = sqlx::query_as( "WITH RECURSIVE subtree AS ( - SELECT id FROM groups WHERE id = $1 + SELECT id, 0 AS depth FROM groups WHERE id = $1 UNION ALL - SELECT g.id FROM groups g JOIN subtree s ON g.parent_id = s.id + SELECT g.id, s.depth + 1 FROM groups g JOIN subtree s ON g.parent_id = s.id + WHERE s.depth < 64 ), app_chain AS ( SELECT a.id AS app_id, a.group_id AS gid, 0 AS depth