From 51ffd5ad44e46bc43acd78756c4abda6ed21aac4 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 17 Dec 2024 15:08:33 +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 b740eb18b..502d65a51 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 @@ -49,6 +50,7 @@ public function getColumns(): array return [ 'id', 'level', + 'parent_id', 'host_id', 'service_id', 'redundancy_group_id', @@ -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']), @@ -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', @@ -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,