From e698f522291af0d8fb7ebaac9046a6ff6f8889dc Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 22 Nov 2019 15:57:45 +0100 Subject: [PATCH] Model: Use correct fk for `service_customvar` and add missing history relations --- library/Icingadb/Model/Host.php | 2 ++ library/Icingadb/Model/Service.php | 2 ++ library/Icingadb/Model/ServiceCustomvar.php | 1 + 3 files changed, 5 insertions(+) diff --git a/library/Icingadb/Model/Host.php b/library/Icingadb/Model/Host.php index 8f534902..16f2a7b9 100644 --- a/library/Icingadb/Model/Host.php +++ b/library/Icingadb/Model/Host.php @@ -117,7 +117,9 @@ class Host extends Model $relations->hasOne('state', HostState::class)->setJoinType('LEFT'); $relations->hasMany('comment', Comment::class); $relations->hasMany('downtime', Downtime::class); + $relations->hasMany('history', History::class); $relations->hasMany('notification', Notification::class); + $relations->hasMany('notification_history', NotificationHistory::class); $relations->hasMany('service', Service::class)->setJoinType('LEFT'); } } diff --git a/library/Icingadb/Model/Service.php b/library/Icingadb/Model/Service.php index 9d169d9e..b34ebc54 100644 --- a/library/Icingadb/Model/Service.php +++ b/library/Icingadb/Model/Service.php @@ -110,6 +110,8 @@ class Service extends Model $relations->hasOne('state', ServiceState::class)->setJoinType('LEFT'); $relations->hasMany('comment', Comment::class); $relations->hasMany('downtime', Downtime::class); + $relations->hasMany('history', History::class); $relations->hasMany('notification', Notification::class); + $relations->hasMany('notification_history', NotificationHistory::class); } } diff --git a/library/Icingadb/Model/ServiceCustomvar.php b/library/Icingadb/Model/ServiceCustomvar.php index 53e34b07..97d1d25c 100644 --- a/library/Icingadb/Model/ServiceCustomvar.php +++ b/library/Icingadb/Model/ServiceCustomvar.php @@ -32,6 +32,7 @@ class ServiceCustomvar extends Model $relations->belongsTo('service', Service::class); $relations->belongsTo('customvar', Customvar::class); $relations->belongsTo('customvar_flat', CustomvarFlat::class) + ->setForeignKey('customvar_id') ->setCandidateKey('customvar_id'); } }