From c859ec3a0d63ce752b740da0c1cbeaf86970938d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 29 Mar 2022 15:27:18 +0200 Subject: [PATCH] Add Binary behavior for binary columns --- .../Icingadb/Model/AcknowledgementHistory.php | 9 +++++++++ library/Icingadb/Model/ActionUrl.php | 6 ++++++ library/Icingadb/Model/Behavior/Binary.php | 8 ++++++++ library/Icingadb/Model/Checkcommand.php | 9 +++++++++ .../Icingadb/Model/CheckcommandArgument.php | 12 ++++++++++++ .../Icingadb/Model/CheckcommandCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/CheckcommandEnvvar.php | 12 ++++++++++++ library/Icingadb/Model/Comment.php | 11 +++++++++++ library/Icingadb/Model/CommentHistory.php | 9 +++++++++ library/Icingadb/Model/Customvar.php | 11 +++++++++++ library/Icingadb/Model/CustomvarFlat.php | 18 +++++++++++++----- library/Icingadb/Model/Downtime.php | 16 ++++++++++++++++ library/Icingadb/Model/DowntimeHistory.php | 11 +++++++++++ library/Icingadb/Model/Endpoint.php | 13 +++++++++++++ library/Icingadb/Model/Environment.php | 9 +++++++++ library/Icingadb/Model/Eventcommand.php | 9 +++++++++ .../Icingadb/Model/EventcommandArgument.php | 12 ++++++++++++ .../Icingadb/Model/EventcommandCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/EventcommandEnvvar.php | 12 ++++++++++++ library/Icingadb/Model/FlappingHistory.php | 9 +++++++++ library/Icingadb/Model/History.php | 16 ++++++++++++++++ library/Icingadb/Model/Host.php | 18 ++++++++++++++++++ library/Icingadb/Model/HostCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/Hostgroup.php | 9 +++++++++ library/Icingadb/Model/HostgroupCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/HostgroupMember.php | 12 ++++++++++++ library/Icingadb/Model/Hostgroupsummary.php | 9 +++++++++ library/Icingadb/Model/IconImage.php | 10 ++++++++++ library/Icingadb/Model/Instance.php | 8 ++++++++ library/Icingadb/Model/NotesUrl.php | 6 ++++++ library/Icingadb/Model/Notification.php | 14 ++++++++++++++ .../Icingadb/Model/NotificationCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/NotificationHistory.php | 12 ++++++++++++ library/Icingadb/Model/NotificationUser.php | 12 ++++++++++++ .../Icingadb/Model/NotificationUsergroup.php | 12 ++++++++++++ library/Icingadb/Model/Notificationcommand.php | 9 +++++++++ .../Model/NotificationcommandArgument.php | 12 ++++++++++++ .../Model/NotificationcommandCustomvar.php | 12 ++++++++++++ .../Model/NotificationcommandEnvvar.php | 12 ++++++++++++ library/Icingadb/Model/Service.php | 17 +++++++++++++++++ library/Icingadb/Model/ServiceCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/Servicegroup.php | 9 +++++++++ .../Icingadb/Model/ServicegroupCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/ServicegroupMember.php | 12 ++++++++++++ library/Icingadb/Model/ServicegroupSummary.php | 9 +++++++++ library/Icingadb/Model/State.php | 9 +++++++++ library/Icingadb/Model/StateHistory.php | 10 +++++++++- library/Icingadb/Model/Timeperiod.php | 9 +++++++++ library/Icingadb/Model/TimeperiodCustomvar.php | 12 ++++++++++++ .../Model/TimeperiodOverrideExclude.php | 12 ++++++++++++ .../Model/TimeperiodOverrideInclude.php | 12 ++++++++++++ library/Icingadb/Model/TimeperiodRange.php | 11 +++++++++++ library/Icingadb/Model/User.php | 11 +++++++++++ library/Icingadb/Model/UserCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/Usergroup.php | 9 +++++++++ library/Icingadb/Model/UsergroupCustomvar.php | 12 ++++++++++++ library/Icingadb/Model/UsergroupMember.php | 12 ++++++++++++ library/Icingadb/Model/Zone.php | 13 +++++++++++++ 58 files changed, 648 insertions(+), 6 deletions(-) diff --git a/library/Icingadb/Model/AcknowledgementHistory.php b/library/Icingadb/Model/AcknowledgementHistory.php index e5fdb010..271b71fe 100644 --- a/library/Icingadb/Model/AcknowledgementHistory.php +++ b/library/Icingadb/Model/AcknowledgementHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; @@ -78,6 +79,14 @@ class AcknowledgementHistory extends Model 'clear_time', 'expire_time' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id', + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/ActionUrl.php b/library/Icingadb/Model/ActionUrl.php index 85bef358..99c6f9bf 100644 --- a/library/Icingadb/Model/ActionUrl.php +++ b/library/Icingadb/Model/ActionUrl.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Icingadb\Model; use Icinga\Module\Icingadb\Model\Behavior\ActionAndNoteUrl; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -40,6 +41,11 @@ class ActionUrl extends Model public function createBehaviors(Behaviors $behaviors) { $behaviors->add(new ActionAndNoteUrl(['action_url'])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/Behavior/Binary.php b/library/Icingadb/Model/Behavior/Binary.php index 2f9d6593..faf0a140 100644 --- a/library/Icingadb/Model/Behavior/Binary.php +++ b/library/Icingadb/Model/Behavior/Binary.php @@ -34,6 +34,14 @@ class Binary extends PropertyBehavior implements QueryAwareBehavior throw new \UnexpectedValueException(sprintf('Unexpected resource for %s', $key)); } + if ($value === '*') { + /** + * Support IS (NOT) NULL filter transformation. + * {@see \ipl\Sql\Compat\FilterProcessor::assemblePredicate()} + */ + return $value; + } + return sprintf('\\x%s', bin2hex($value)); } diff --git a/library/Icingadb/Model/Checkcommand.php b/library/Icingadb/Model/Checkcommand.php index 7bb1cdbe..98d2caa3 100644 --- a/library/Icingadb/Model/Checkcommand.php +++ b/library/Icingadb/Model/Checkcommand.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -55,6 +56,14 @@ class Checkcommand extends Model 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'zone_id', + 'environment_id', + 'name_checksum', + 'properties_checksum' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/CheckcommandArgument.php b/library/Icingadb/Model/CheckcommandArgument.php index 381da3e3..df7942d5 100644 --- a/library/Icingadb/Model/CheckcommandArgument.php +++ b/library/Icingadb/Model/CheckcommandArgument.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -55,6 +57,16 @@ class CheckcommandArgument extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'checkcommand_id', + 'environment_id', + 'properties_checksum' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/CheckcommandCustomvar.php b/library/Icingadb/Model/CheckcommandCustomvar.php index 996fc34c..90d36b13 100644 --- a/library/Icingadb/Model/CheckcommandCustomvar.php +++ b/library/Icingadb/Model/CheckcommandCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class CheckcommandCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'checkcommand_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/CheckcommandEnvvar.php b/library/Icingadb/Model/CheckcommandEnvvar.php index c47009de..159d4dc3 100644 --- a/library/Icingadb/Model/CheckcommandEnvvar.php +++ b/library/Icingadb/Model/CheckcommandEnvvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -41,6 +43,16 @@ class CheckcommandEnvvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'checkcommand_id', + 'environment_id', + 'properties_checksum' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Comment.php b/library/Icingadb/Model/Comment.php index e5ed6bb3..34905e91 100644 --- a/library/Icingadb/Model/Comment.php +++ b/library/Icingadb/Model/Comment.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; @@ -91,6 +92,16 @@ class Comment extends Model 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'host_id', + 'service_id', + 'name_checksum', + 'properties_checksum', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/CommentHistory.php b/library/Icingadb/Model/CommentHistory.php index 0a44494e..09cb9ab4 100644 --- a/library/Icingadb/Model/CommentHistory.php +++ b/library/Icingadb/Model/CommentHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; @@ -83,6 +84,14 @@ class CommentHistory extends Model 'expire_time', 'remove_time' ])); + + $behaviors->add(new Binary([ + 'comment_id', + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/Customvar.php b/library/Icingadb/Model/Customvar.php index f568292f..c95118b5 100644 --- a/library/Icingadb/Model/Customvar.php +++ b/library/Icingadb/Model/Customvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -29,6 +31,15 @@ class Customvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/CustomvarFlat.php b/library/Icingadb/Model/CustomvarFlat.php index e63f9581..9350a812 100644 --- a/library/Icingadb/Model/CustomvarFlat.php +++ b/library/Icingadb/Model/CustomvarFlat.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\FlattenedObjectVars; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -33,6 +34,18 @@ class CustomvarFlat extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new FlattenedObjectVars()); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'customvar_id', + 'flatname_checksum' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); @@ -73,11 +86,6 @@ class CustomvarFlat extends Model ->setCandidateKey('customvar_id'); } - public function createBehaviors(Behaviors $behaviors) - { - $behaviors->add(new FlattenedObjectVars()); - } - /** * Restore flattened custom variables to their previous structure * diff --git a/library/Icingadb/Model/Downtime.php b/library/Icingadb/Model/Downtime.php index 40db0ec9..c65f8f48 100644 --- a/library/Icingadb/Model/Downtime.php +++ b/library/Icingadb/Model/Downtime.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\IdKey; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; @@ -95,10 +96,12 @@ class Downtime extends Model public function createBehaviors(Behaviors $behaviors) { $behaviors->add(new IdKey()); + $behaviors->add(new BoolCast([ 'is_flexible', 'is_in_effect' ])); + $behaviors->add(new Timestamp([ 'entry_time', 'scheduled_start_time', @@ -109,10 +112,23 @@ class Downtime extends Model 'end_time', 'duration' ])); + $behaviors->add(new ReRoute([ 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'triggered_by_id', + 'parent_id', + 'host_id', + 'service_id', + 'name_checksum', + 'properties_checksum', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/DowntimeHistory.php b/library/Icingadb/Model/DowntimeHistory.php index 47f16497..3a17a369 100644 --- a/library/Icingadb/Model/DowntimeHistory.php +++ b/library/Icingadb/Model/DowntimeHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; @@ -97,6 +98,16 @@ class DowntimeHistory extends Model 'trigger_time', 'cancel_time' ])); + + $behaviors->add(new Binary([ + 'downtime_id', + 'environment_id', + 'endpoint_id', + 'triggered_by_id', + 'parent_id', + 'host_id', + 'service_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/Endpoint.php b/library/Icingadb/Model/Endpoint.php index e764fc62..cb4d2fe1 100644 --- a/library/Icingadb/Model/Endpoint.php +++ b/library/Icingadb/Model/Endpoint.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -43,6 +45,17 @@ class Endpoint extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'zone_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Environment.php b/library/Icingadb/Model/Environment.php index 0c86e3c9..8065e10c 100644 --- a/library/Icingadb/Model/Environment.php +++ b/library/Icingadb/Model/Environment.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -33,6 +35,13 @@ class Environment extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id' + ])); + } + public function createRelations(Relations $relations) { $relations->hasMany('acknowledgement_history', AcknowledgementHistory::class); diff --git a/library/Icingadb/Model/Eventcommand.php b/library/Icingadb/Model/Eventcommand.php index 9edab05b..045e0a7b 100644 --- a/library/Icingadb/Model/Eventcommand.php +++ b/library/Icingadb/Model/Eventcommand.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -55,6 +56,14 @@ class Eventcommand extends Model 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'zone_id', + 'environment_id', + 'name_checksum', + 'properties_checksum' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/EventcommandArgument.php b/library/Icingadb/Model/EventcommandArgument.php index e60fc10e..fd66be00 100644 --- a/library/Icingadb/Model/EventcommandArgument.php +++ b/library/Icingadb/Model/EventcommandArgument.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -55,6 +57,16 @@ class EventcommandArgument extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'eventcommand_id', + 'environment_id', + 'properties_checksum' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/EventcommandCustomvar.php b/library/Icingadb/Model/EventcommandCustomvar.php index 4eee0a7f..78a37284 100644 --- a/library/Icingadb/Model/EventcommandCustomvar.php +++ b/library/Icingadb/Model/EventcommandCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class EventcommandCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'eventcommand_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/EventcommandEnvvar.php b/library/Icingadb/Model/EventcommandEnvvar.php index a4781ec9..f6c8d2ec 100644 --- a/library/Icingadb/Model/EventcommandEnvvar.php +++ b/library/Icingadb/Model/EventcommandEnvvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -41,6 +43,16 @@ class EventcommandEnvvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'eventcommand_id', + 'environment_id', + 'properties_checksum' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/FlappingHistory.php b/library/Icingadb/Model/FlappingHistory.php index ee5fc477..d740e9e4 100644 --- a/library/Icingadb/Model/FlappingHistory.php +++ b/library/Icingadb/Model/FlappingHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; @@ -68,6 +69,14 @@ class FlappingHistory extends Model 'start_time', 'end_time' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/History.php b/library/Icingadb/Model/History.php index e95b3c83..5a0e13e1 100644 --- a/library/Icingadb/Model/History.php +++ b/library/Icingadb/Model/History.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; @@ -70,10 +71,25 @@ class History extends Model $behaviors->add(new Timestamp([ 'event_time' ])); + $behaviors->add(new ReRoute([ 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id', + 'comment_history_id', + 'downtime_history_id', + 'flapping_history_id', + 'notification_history_id', + 'acknowledgement_history_id', + 'state_history_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/Host.php b/library/Icingadb/Model/Host.php index 1030ab1d..fbbc1f75 100644 --- a/library/Icingadb/Model/Host.php +++ b/library/Icingadb/Model/Host.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Icingadb\Model; use Icinga\Module\Icingadb\Common\Auth; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; @@ -143,6 +144,23 @@ class Host extends Model 'user' => 'notification.user', 'usergroup' => 'notification.usergroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'address_bin', + 'address6_bin', + 'checkcommand_id', + 'check_timeperiod_id', + 'eventcommand_id', + 'action_url_id', + 'notes_url_id', + 'icon_image_id', + 'zone_id', + 'command_endpoint_id' + ])); } public function createDefaults(Defaults $defaults) diff --git a/library/Icingadb/Model/HostCustomvar.php b/library/Icingadb/Model/HostCustomvar.php index 14bed290..e5bec7d5 100644 --- a/library/Icingadb/Model/HostCustomvar.php +++ b/library/Icingadb/Model/HostCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class HostCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'host_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Hostgroup.php b/library/Icingadb/Model/Hostgroup.php index ff5f0543..52460f85 100644 --- a/library/Icingadb/Model/Hostgroup.php +++ b/library/Icingadb/Model/Hostgroup.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -62,6 +63,14 @@ class Hostgroup extends Model $behaviors->add(new ReRoute([ 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/HostgroupCustomvar.php b/library/Icingadb/Model/HostgroupCustomvar.php index 834ee613..91ea6fac 100644 --- a/library/Icingadb/Model/HostgroupCustomvar.php +++ b/library/Icingadb/Model/HostgroupCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class HostgroupCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'hostgroup_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/HostgroupMember.php b/library/Icingadb/Model/HostgroupMember.php index 25827069..ede8de96 100644 --- a/library/Icingadb/Model/HostgroupMember.php +++ b/library/Icingadb/Model/HostgroupMember.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class HostgroupMember extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'host_id', + 'hostgroup_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Hostgroupsummary.php b/library/Icingadb/Model/Hostgroupsummary.php index c8bce66a..8c050ce6 100644 --- a/library/Icingadb/Model/Hostgroupsummary.php +++ b/library/Icingadb/Model/Hostgroupsummary.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\UnionModel; use ipl\Sql\Expression; @@ -155,4 +157,11 @@ class Hostgroupsummary extends UnionModel return $unions; } + + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id' + ])); + } } diff --git a/library/Icingadb/Model/IconImage.php b/library/Icingadb/Model/IconImage.php index 1d219f50..0c899e65 100644 --- a/library/Icingadb/Model/IconImage.php +++ b/library/Icingadb/Model/IconImage.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -35,6 +37,14 @@ class IconImage extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Instance.php b/library/Icingadb/Model/Instance.php index 96e40686..a0d490ec 100644 --- a/library/Icingadb/Model/Instance.php +++ b/library/Icingadb/Model/Instance.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; @@ -51,6 +52,7 @@ class Instance extends Model 'heartbeat', 'icinga2_start_time' ])); + $behaviors->add(new BoolCast([ 'responsible', 'icinga2_active_host_checks_enabled', @@ -60,6 +62,12 @@ class Instance extends Model 'icinga2_notifications_enabled', 'icinga2_performance_data_enabled' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'endpoint_id', + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/NotesUrl.php b/library/Icingadb/Model/NotesUrl.php index 78224e03..785d9e13 100644 --- a/library/Icingadb/Model/NotesUrl.php +++ b/library/Icingadb/Model/NotesUrl.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Icingadb\Model; use Icinga\Module\Icingadb\Model\Behavior\ActionAndNoteUrl; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -40,6 +41,11 @@ class NotesUrl extends Model public function createBehaviors(Behaviors $behaviors) { $behaviors->add(new ActionAndNoteUrl(['notes_url'])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/Notification.php b/library/Icingadb/Model/Notification.php index f960e062..1921966d 100644 --- a/library/Icingadb/Model/Notification.php +++ b/library/Icingadb/Model/Notification.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\Bitmask; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; @@ -70,6 +71,7 @@ class Notification extends Model 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + $behaviors->add(new Bitmask([ 'states' => [ 'ok' => 1, @@ -91,6 +93,18 @@ class Notification extends Model 'flapping_end' => 256 ] ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'host_id', + 'service_id', + 'notificationcommand_id', + 'timeperiod_id', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/NotificationCustomvar.php b/library/Icingadb/Model/NotificationCustomvar.php index fd474f4f..456ecd48 100644 --- a/library/Icingadb/Model/NotificationCustomvar.php +++ b/library/Icingadb/Model/NotificationCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class NotificationCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'notification_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/NotificationHistory.php b/library/Icingadb/Model/NotificationHistory.php index 46ed476e..d3e8a11d 100644 --- a/library/Icingadb/Model/NotificationHistory.php +++ b/library/Icingadb/Model/NotificationHistory.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\IdKey; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; @@ -81,13 +82,24 @@ class NotificationHistory extends Model public function createBehaviors(Behaviors $behaviors) { $behaviors->add(new IdKey()); + $behaviors->add(new Timestamp([ 'send_time' ])); + $behaviors->add(new ReRoute([ 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id', + 'notification_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/NotificationUser.php b/library/Icingadb/Model/NotificationUser.php index 49a917fe..2a58bd51 100644 --- a/library/Icingadb/Model/NotificationUser.php +++ b/library/Icingadb/Model/NotificationUser.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class NotificationUser extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'notification_id', + 'user_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/NotificationUsergroup.php b/library/Icingadb/Model/NotificationUsergroup.php index 1a63359f..92e2f8f9 100644 --- a/library/Icingadb/Model/NotificationUsergroup.php +++ b/library/Icingadb/Model/NotificationUsergroup.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class NotificationUsergroup extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'notification_id', + 'usergroup_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Notificationcommand.php b/library/Icingadb/Model/Notificationcommand.php index f53448d8..bbf7e8fc 100644 --- a/library/Icingadb/Model/Notificationcommand.php +++ b/library/Icingadb/Model/Notificationcommand.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -57,6 +58,14 @@ class Notificationcommand extends Model 'service' => 'notification.service', 'servicegroup' => 'notification.service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'zone_id', + 'environment_id', + 'name_checksum', + 'properties_checksum' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/NotificationcommandArgument.php b/library/Icingadb/Model/NotificationcommandArgument.php index bfb08342..2b8a3515 100644 --- a/library/Icingadb/Model/NotificationcommandArgument.php +++ b/library/Icingadb/Model/NotificationcommandArgument.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -55,6 +57,16 @@ class NotificationcommandArgument extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'notificationcommand_id', + 'environment_id', + 'properties_checksum' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/NotificationcommandCustomvar.php b/library/Icingadb/Model/NotificationcommandCustomvar.php index 84414afd..72243c76 100644 --- a/library/Icingadb/Model/NotificationcommandCustomvar.php +++ b/library/Icingadb/Model/NotificationcommandCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class NotificationcommandCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'notificationcommand_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/NotificationcommandEnvvar.php b/library/Icingadb/Model/NotificationcommandEnvvar.php index 0689073a..989ef51b 100644 --- a/library/Icingadb/Model/NotificationcommandEnvvar.php +++ b/library/Icingadb/Model/NotificationcommandEnvvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -41,6 +43,16 @@ class NotificationcommandEnvvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'notificationcommand_id', + 'environment_id', + 'properties_checksum', + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Service.php b/library/Icingadb/Model/Service.php index 4ed7b806..7c7c3539 100644 --- a/library/Icingadb/Model/Service.php +++ b/library/Icingadb/Model/Service.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Icingadb\Model; use Icinga\Module\Icingadb\Common\Auth; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; @@ -133,6 +134,22 @@ class Service extends Model 'user' => 'notification.user', 'usergroup' => 'notification.usergroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'host_id', + 'checkcommand_id', + 'check_timeperiod_id', + 'eventcommand_id', + 'action_url_id', + 'notes_url_id', + 'icon_image_id', + 'zone_id', + 'command_endpoint_id' + ])); } public function createDefaults(Defaults $defaults) diff --git a/library/Icingadb/Model/ServiceCustomvar.php b/library/Icingadb/Model/ServiceCustomvar.php index 089be591..e4f65e32 100644 --- a/library/Icingadb/Model/ServiceCustomvar.php +++ b/library/Icingadb/Model/ServiceCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class ServiceCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'service_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Servicegroup.php b/library/Icingadb/Model/Servicegroup.php index a7f82d5e..9ad79fd5 100644 --- a/library/Icingadb/Model/Servicegroup.php +++ b/library/Icingadb/Model/Servicegroup.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -63,6 +64,14 @@ class Servicegroup extends Model 'host' => 'service.host', 'hostgroup' => 'service.hostgroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/ServicegroupCustomvar.php b/library/Icingadb/Model/ServicegroupCustomvar.php index 2f98aef0..6b6ca11c 100644 --- a/library/Icingadb/Model/ServicegroupCustomvar.php +++ b/library/Icingadb/Model/ServicegroupCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class ServicegroupCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'servicegroup_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/ServicegroupMember.php b/library/Icingadb/Model/ServicegroupMember.php index d09e6b5d..57e12421 100644 --- a/library/Icingadb/Model/ServicegroupMember.php +++ b/library/Icingadb/Model/ServicegroupMember.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class ServicegroupMember extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'service_id', + 'servicegroup_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/ServicegroupSummary.php b/library/Icingadb/Model/ServicegroupSummary.php index 8ac0779f..f434a978 100644 --- a/library/Icingadb/Model/ServicegroupSummary.php +++ b/library/Icingadb/Model/ServicegroupSummary.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\UnionModel; use ipl\Sql\Expression; @@ -106,4 +108,11 @@ class ServicegroupSummary extends UnionModel return $unions; } + + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id' + ])); + } } diff --git a/library/Icingadb/Model/State.php b/library/Icingadb/Model/State.php index 4d590583..7c7b96d7 100644 --- a/library/Icingadb/Model/State.php +++ b/library/Icingadb/Model/State.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\BoolCast; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; @@ -62,6 +63,7 @@ abstract class State extends Model 'is_acknowledged', 'in_downtime' ])); + $behaviors->add(new Timestamp([ 'execution_time', 'latency', @@ -70,5 +72,12 @@ abstract class State extends Model 'next_check', 'next_update' ])); + + $behaviors->add(new Binary([ + $this->getKeyName(), + 'environment_id', + 'acknowledgement_comment_id', + 'last_comment_id' + ])); } } diff --git a/library/Icingadb/Model/StateHistory.php b/library/Icingadb/Model/StateHistory.php index e5e0ac66..cc9159b0 100644 --- a/library/Icingadb/Model/StateHistory.php +++ b/library/Icingadb/Model/StateHistory.php @@ -4,11 +4,11 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\Timestamp; use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; -use ipl\Sql\Expression; /** * Model for table `state_history` @@ -78,6 +78,14 @@ class StateHistory extends Model $behaviors->add(new Timestamp([ 'event_time' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'endpoint_id', + 'host_id', + 'service_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/Timeperiod.php b/library/Icingadb/Model/Timeperiod.php index acab81bb..206e49aa 100644 --- a/library/Icingadb/Model/Timeperiod.php +++ b/library/Icingadb/Model/Timeperiod.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -55,6 +56,14 @@ class Timeperiod extends Model 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/TimeperiodCustomvar.php b/library/Icingadb/Model/TimeperiodCustomvar.php index 549cad92..16e176a3 100644 --- a/library/Icingadb/Model/TimeperiodCustomvar.php +++ b/library/Icingadb/Model/TimeperiodCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class TimeperiodCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'timeperiod_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/TimeperiodOverrideExclude.php b/library/Icingadb/Model/TimeperiodOverrideExclude.php index 44facd0d..9760d6be 100644 --- a/library/Icingadb/Model/TimeperiodOverrideExclude.php +++ b/library/Icingadb/Model/TimeperiodOverrideExclude.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class TimeperiodOverrideExclude extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'timeperiod_id', + 'override_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/TimeperiodOverrideInclude.php b/library/Icingadb/Model/TimeperiodOverrideInclude.php index c75964c9..8a337f81 100644 --- a/library/Icingadb/Model/TimeperiodOverrideInclude.php +++ b/library/Icingadb/Model/TimeperiodOverrideInclude.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class TimeperiodOverrideInclude extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'timeperiod_id', + 'override_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/TimeperiodRange.php b/library/Icingadb/Model/TimeperiodRange.php index baf02d34..0f71d60a 100644 --- a/library/Icingadb/Model/TimeperiodRange.php +++ b/library/Icingadb/Model/TimeperiodRange.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -39,6 +41,15 @@ class TimeperiodRange extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'timeperiod_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/User.php b/library/Icingadb/Model/User.php index dfc684ec..922a71a5 100644 --- a/library/Icingadb/Model/User.php +++ b/library/Icingadb/Model/User.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\Bitmask; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; @@ -78,6 +79,7 @@ class User extends Model 'hostgroup' => 'notification.host.hostgroup', 'servicegroup' => 'notification.service.servicegroup' ])); + $behaviors->add(new Bitmask([ 'states' => [ 'ok' => 1, @@ -99,6 +101,15 @@ class User extends Model 'flapping_end' => 256 ] ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'timeperiod_id', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/UserCustomvar.php b/library/Icingadb/Model/UserCustomvar.php index fa2a1f7f..6a2a6a38 100644 --- a/library/Icingadb/Model/UserCustomvar.php +++ b/library/Icingadb/Model/UserCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class UserCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'user_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Usergroup.php b/library/Icingadb/Model/Usergroup.php index 04ee45c1..6baff30e 100644 --- a/library/Icingadb/Model/Usergroup.php +++ b/library/Icingadb/Model/Usergroup.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; use Icinga\Module\Icingadb\Model\Behavior\ReRoute; use ipl\Orm\Behaviors; use ipl\Orm\Model; @@ -65,6 +66,14 @@ class Usergroup extends Model 'hostgroup' => 'notification.host.hostgroup', 'servicegroup' => 'notification.service.servicegroup' ])); + + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'zone_id' + ])); } public function createRelations(Relations $relations) diff --git a/library/Icingadb/Model/UsergroupCustomvar.php b/library/Icingadb/Model/UsergroupCustomvar.php index 0375e3cb..d9623cd3 100644 --- a/library/Icingadb/Model/UsergroupCustomvar.php +++ b/library/Icingadb/Model/UsergroupCustomvar.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class UsergroupCustomvar extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'usergroup_id', + 'customvar_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/UsergroupMember.php b/library/Icingadb/Model/UsergroupMember.php index 2e8f3522..40690a21 100644 --- a/library/Icingadb/Model/UsergroupMember.php +++ b/library/Icingadb/Model/UsergroupMember.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -28,6 +30,16 @@ class UsergroupMember extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'user_id', + 'usergroup_id', + 'environment_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class); diff --git a/library/Icingadb/Model/Zone.php b/library/Icingadb/Model/Zone.php index 471848cb..63e4c71f 100644 --- a/library/Icingadb/Model/Zone.php +++ b/library/Icingadb/Model/Zone.php @@ -4,6 +4,8 @@ namespace Icinga\Module\Icingadb\Model; +use Icinga\Module\Icingadb\Model\Behavior\Binary; +use ipl\Orm\Behaviors; use ipl\Orm\Model; use ipl\Orm\Relations; @@ -47,6 +49,17 @@ class Zone extends Model ]; } + public function createBehaviors(Behaviors $behaviors) + { + $behaviors->add(new Binary([ + 'id', + 'environment_id', + 'name_checksum', + 'properties_checksum', + 'parent_id' + ])); + } + public function createRelations(Relations $relations) { $relations->belongsTo('environment', Environment::class);