Add Binary behavior for binary columns

This commit is contained in:
Eric Lippmann 2022-03-29 15:27:18 +02:00 committed by Johannes Meyer
parent 802d222955
commit c859ec3a0d
58 changed files with 648 additions and 6 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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));
}

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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
*

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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'
]));
}
}

View file

@ -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);

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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'
]));
}
}

View file

@ -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'
]));
}
}

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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);