diff --git a/library/Icingadb/Model/SlaHistoryDowntime.php b/library/Icingadb/Model/SlaHistoryDowntime.php new file mode 100644 index 00000000..1fb5e948 --- /dev/null +++ b/library/Icingadb/Model/SlaHistoryDowntime.php @@ -0,0 +1,75 @@ +add(new MillisecondTimestamp([ + 'downtime_start', + 'downtime_end' + ])); + + $behaviors->add(new Binary([ + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id', + 'downtime_id' + ])); + } + + public function createRelations(Relations $relations) + { + $relations->belongsTo('endpoint', Endpoint::class); + $relations->belongsTo('environment', Environment::class); + $relations->belongsTo('host', Host::class)->setJoinType('LEFT'); + $relations->belongsTo('service', Service::class)->setJoinType('LEFT'); + $relations->belongsTo('downtime', Downtime::class)->setJoinType('LEFT'); + } +} diff --git a/library/Icingadb/Model/SlaHistoryState.php b/library/Icingadb/Model/SlaHistoryState.php new file mode 100644 index 00000000..41560993 --- /dev/null +++ b/library/Icingadb/Model/SlaHistoryState.php @@ -0,0 +1,73 @@ +add(new MillisecondTimestamp([ + 'event_time' + ])); + + $behaviors->add(new Binary([ + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id', + 'downtime_id' + ])); + } + + public function createRelations(Relations $relations) + { + $relations->belongsTo('endpoint', Endpoint::class); + $relations->belongsTo('environment', Environment::class); + $relations->belongsTo('host', Host::class)->setJoinType('LEFT'); + $relations->belongsTo('service', Service::class)->setJoinType('LEFT'); + } +}