Skip to content

Commit

Permalink
UnreachableParent: Fetch from column as parent_id
Browse files Browse the repository at this point in the history
This column is required to make prepare the path chain of root-problem
  • Loading branch information
sukhwinder33445 committed Dec 17, 2024
1 parent c8eaa17 commit 51ffd5a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/Icingadb/Model/UnreachableParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
* @property string $id
* @property int $level
* @property string $parent_id
* @property ?string $host_id
* @property ?string $service_id
* @property ?string $redundancy_group_id
Expand Down Expand Up @@ -49,6 +50,7 @@ public function getColumns(): array
return [
'id',
'level',
'parent_id',
'host_id',
'service_id',
'redundancy_group_id',
Expand Down Expand Up @@ -122,6 +124,7 @@ private static function selectNodes(Connection $db, Model $root): Select
$rootQuery = DependencyNode::on($db)
->columns([
'id' => 'id',
'parent_id' => 'id',
'level' => new Expression('0'),
'host_id' => 'host_id',
'service_id' => new Expression("COALESCE(%s, CAST('' as binary(20)))", ['service_id']),
Expand All @@ -148,6 +151,7 @@ private static function selectNodes(Connection $db, Model $root): Select
$nodeQuery = DependencyEdge::on($db)
->columns([
'id' => 'to_node_id',
'parent_id' => 'from_node_id',
'level' => new Expression('urn.level + 1'),
'host_id' => 'to.host_id',
'service_id' => 'to.service_id',
Expand All @@ -168,6 +172,7 @@ private static function selectNodes(Connection $db, Model $root): Select
$columnsProperty->setValue($nodeSelect, array_merge(
[
'id' => null,
'parent_id' => null,
'level' => null,
'host_id' => null,
'service_id' => null,
Expand Down

0 comments on commit 51ffd5a

Please sign in to comment.