« blib/lib/App/Netdisco/DB/Result/DevicePortWireless.pm
↑ Summary
blib/lib/App/Netdisco/DB/Result/DeviceVlan.pm »
| 1 | use utf8; | ||
| 2 | package App::Netdisco::DB::Result::DevicePower; | ||
| 3 | |||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use 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 | |||
| 28 | Returns 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 | |||
| 36 | Returns 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 | |||
| 44 | 1; |