From ce10eb62fc875d548a247e94b64d1537d38225ef 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 | 17 +++++++++++++++++ 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, 647 insertions(+), 6 deletions(-) diff --git a/library/Icingadb/Model/AcknowledgementHistory.php b/library/Icingadb/Model/AcknowledgementHistory.php index e5fdb0107..271b71feb 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 @@ public function createBehaviors(Behaviors $behaviors) '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 611862332..91da6dac4 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 @@ public function getMetaData() 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 2f9d65934..faf0a1407 100644 --- a/library/Icingadb/Model/Behavior/Binary.php +++ b/library/Icingadb/Model/Behavior/Binary.php @@ -34,6 +34,14 @@ public function toDb($value, $key, $_) 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 7bb1cdbef..98d2caa3d 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 @@ public function createBehaviors(Behaviors $behaviors) '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 381da3e30..df7942d50 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 @@ public function getMetaData() ]; } + 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 996fc34cc..90d36b13c 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 @@ public function getColumns() ]; } + 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 c47009dee..159d4dc38 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 @@ public function getMetaData() ]; } + 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 e5ed6bb37..34905e91a 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 @@ public function createBehaviors(Behaviors $behaviors) '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 0a44494ef..09cb9ab4d 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 @@ public function createBehaviors(Behaviors $behaviors) '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 7019d56d7..5bb35f028 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; @@ -31,6 +33,15 @@ public function getColumns() ]; } + 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 e63f9581b..9350a812c 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 @@ public function getColumns() ]; } + 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 @@ public function createRelations(Relations $relations) ->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 40db0ec92..c65f8f486 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 @@ public function getDefaultSort() 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 @@ public function createBehaviors(Behaviors $behaviors) '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 47f16497f..3a17a3698 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 @@ public function createBehaviors(Behaviors $behaviors) '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 e764fc620..cb4d2fe1d 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 @@ public function getMetaData() ]; } + 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 0c86e3c91..8065e10c3 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 @@ public function getMetaData() ]; } + 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 9edab05b6..045e0a7b1 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 @@ public function createBehaviors(Behaviors $behaviors) '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 e60fc10ea..fd66be007 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 @@ public function getMetaData() ]; } + 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 4eee0a7f2..78a372848 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 @@ public function getColumns() ]; } + 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 a4781ec93..f6c8d2ec7 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 @@ public function getMetaData() ]; } + 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 ee5fc477f..d740e9e42 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 @@ public function createBehaviors(Behaviors $behaviors) '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 e95b3c837..5a0e13e14 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 @@ public function createBehaviors(Behaviors $behaviors) $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 032c29697..387b0b51e 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; @@ -145,6 +146,22 @@ public function createBehaviors(Behaviors $behaviors) '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', + 'zone_id', + 'command_endpoint_id' + ])); } /** diff --git a/library/Icingadb/Model/HostCustomvar.php b/library/Icingadb/Model/HostCustomvar.php index 14bed290b..e5bec7d51 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 @@ public function getColumns() ]; } + 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 ff5f0543a..52460f85e 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 @@ public function createBehaviors(Behaviors $behaviors) $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 834ee6133..91ea6fac3 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 @@ public function getColumns() ]; } + 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 258270693..ede8de96d 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 @@ public function getColumns() ]; } + 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 c8bce66a7..8c050ce6e 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 @@ public function getUnions() 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 317ab63cd..3f8b32be0 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 @@ public function getMetaData() ]; } + 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 433435086..2bd4cca0e 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 @@ public function createBehaviors(Behaviors $behaviors) 'heartbeat', 'icinga2_start_time' ])); + $behaviors->add(new BoolCast([ 'responsible', 'icinga2_active_host_checks_enabled', @@ -60,6 +62,12 @@ public function createBehaviors(Behaviors $behaviors) '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 6cc3c2b12..8e04a87a8 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 @@ public function getMetaData() 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 f960e062c..1921966d1 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 @@ public function createBehaviors(Behaviors $behaviors) 'hostgroup' => 'host.hostgroup', 'servicegroup' => 'service.servicegroup' ])); + $behaviors->add(new Bitmask([ 'states' => [ 'ok' => 1, @@ -91,6 +93,18 @@ public function createBehaviors(Behaviors $behaviors) '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 fd474f4f7..456ecd486 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 @@ public function getColumns() ]; } + 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 46ed476e5..d3e8a11d4 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 @@ public function getDefaultSort() 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 49a917fec..2a58bd516 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 @@ public function getColumns() ]; } + 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 1a63359f5..92e2f8f9d 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 @@ public function getColumns() ]; } + 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 f53448d85..bbf7e8fc9 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 @@ public function createBehaviors(Behaviors $behaviors) '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 bfb08342c..2b8a35150 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 @@ public function getMetaData() ]; } + 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 84414afd4..72243c769 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 @@ public function getColumns() ]; } + 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 0689073ae..989ef51b9 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 @@ public function getMetaData() ]; } + 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 61e12d8c2..652f7af8e 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; @@ -135,6 +136,22 @@ public function createBehaviors(Behaviors $behaviors) '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' + ])); } /** diff --git a/library/Icingadb/Model/ServiceCustomvar.php b/library/Icingadb/Model/ServiceCustomvar.php index 089be591c..e4f65e321 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 @@ public function getColumns() ]; } + 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 a7f82d5e3..9ad79fd5c 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 @@ public function createBehaviors(Behaviors $behaviors) '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 2f98aef02..6b6ca11c4 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 @@ public function getColumns() ]; } + 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 d09e6b5dc..57e12421a 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 @@ public function getColumns() ]; } + 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 8ac0779f5..f434a9787 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 @@ public function getUnions() 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 4d5905831..7c7b96d7e 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 @@ public function createBehaviors(Behaviors $behaviors) 'is_acknowledged', 'in_downtime' ])); + $behaviors->add(new Timestamp([ 'execution_time', 'latency', @@ -70,5 +72,12 @@ public function createBehaviors(Behaviors $behaviors) '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 e5e0ac668..cc9159b05 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 @@ public function createBehaviors(Behaviors $behaviors) $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 acab81bbb..206e49aaa 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 @@ public function createBehaviors(Behaviors $behaviors) '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 549cad92d..16e176a39 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 @@ public function getColumns() ]; } + 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 44facd0de..9760d6be3 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 @@ public function getColumns() ]; } + 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 c75964c9d..8a337f810 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 @@ public function getColumns() ]; } + 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 baf02d340..0f71d60af 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 @@ public function getMetaData() ]; } + 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 dfc684ec3..922a71a5c 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 @@ public function createBehaviors(Behaviors $behaviors) 'hostgroup' => 'notification.host.hostgroup', 'servicegroup' => 'notification.service.servicegroup' ])); + $behaviors->add(new Bitmask([ 'states' => [ 'ok' => 1, @@ -99,6 +101,15 @@ public function createBehaviors(Behaviors $behaviors) '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 fa2a1f7f3..6a2a6a384 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 @@ public function getColumns() ]; } + 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 04ee45c18..6baff30ee 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 @@ public function createBehaviors(Behaviors $behaviors) '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 0375e3cbf..d9623cd3f 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 @@ public function getColumns() ]; } + 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 2e8f35229..40690a214 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 @@ public function getColumns() ]; } + 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 471848cb8..63e4c71f5 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 @@ public function getMetaData() ]; } + 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);