From b54c6e6107fda9231bad319083f2785de8559ce3 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 17 Dec 2024 15:19:48 +0100 Subject: [PATCH] UnreachableParent: Fetch `from` column as `parent_id` This column is required to make prepare the path chain of root-problem --- library/Icingadb/Model/UnreachableParent.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/Icingadb/Model/UnreachableParent.php b/library/Icingadb/Model/UnreachableParent.php index 6ba633aac..a7a49a616 100644 --- a/library/Icingadb/Model/UnreachableParent.php +++ b/library/Icingadb/Model/UnreachableParent.php @@ -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 @@ -48,6 +49,7 @@ public function getColumns(): array { return [ 'id', + 'parent_id', 'level', 'host_id', 'service_id', @@ -109,6 +111,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']), @@ -135,6 +138,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', @@ -155,6 +159,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,