1use utf8;
2package App::Netdisco::DB::Result::DevicePower;
3
4
5use strict;
6use warnings;
7
8use base 'App::Netdisco::DB::Result';
9__PACKAGE__->table("device_power");
10__PACKAGE__->add_columns(
11  "ip",
12  { data_type => "inet", is_nullable => 0 },
13  "module",
14  { data_type => "integer", is_nullable => 0 },
15  "power",
16  { data_type => "integer", is_nullable => 1 },
17  "status",
18  { data_type => "text", is_nullable => 1 },
19);
20__PACKAGE__->set_primary_key("ip", "module");
21
22
23
24=head1 RELATIONSHIPS
25
26=head2 device
27
28Returns the entry from the C<device> table on which this power module was discovered.
29
30=cut
31
32__PACKAGE__->belongs_to( device => 'App::Netdisco::DB::Result::Device', 'ip' );
33
34=head2 ports
35
36Returns the set of PoE ports associated with a power module.
37
38=cut
39
40__PACKAGE__->has_many( ports => 'App::Netdisco::DB::Result::DevicePortPower', {
41  'foreign.ip' => 'self.ip', 'foreign.module' => 'self.module',
42} );
43
441;
45