Skip to content

Commit

Permalink
WIP: Make join type left
Browse files Browse the repository at this point in the history
The DependecyNodeSummary requires left joins to summarise all available rows, while the redundancy group joins nodes and edges as inner joins, which leads to false positives.
  • Loading branch information
sukhwinder33445 committed Oct 9, 2024
1 parent 9506986 commit 6e591e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions library/Icingadb/Model/DependencyEdge.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ public function createRelations(Relations $relations): void

// "from" and "to" are only necessary for sub-query filters.
$relations->belongsTo('from', DependencyNode::class)
->setCandidateKey('from_node_id');
->setCandidateKey('from_node_id')
->setJoinType('LEFT');
$relations->belongsTo('to', DependencyNode::class)
->setCandidateKey('to_node_id');
->setCandidateKey('to_node_id')
->setJoinType('LEFT');
}
}
6 changes: 4 additions & 2 deletions library/Icingadb/Model/RedundancyGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ public function createRelations(Relations $relations): void
$relations->belongsToMany('from', DependencyEdge::class)
->setTargetCandidateKey('from_node_id')
->setTargetForeignKey('id')
->through(DependencyNode::class);
->through(DependencyNode::class)
->setJoinType('LEFT');
$relations->belongsToMany('to', DependencyEdge::class)
->setTargetCandidateKey('to_node_id')
->setTargetForeignKey('id')
->through(DependencyNode::class);
->through(DependencyNode::class)
->setJoinType('LEFT');
}
}

0 comments on commit 6e591e2

Please sign in to comment.