package App::Netdisco::DB::Result::Virtual::DeviceLinks; use strict; use warnings; use base 'DBIx::Class::Core'; __PACKAGE__->table_class('DBIx::Class::ResultSource::View'); __PACKAGE__->table('device_links'); __PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->view_definition(<add_columns( 'left_ip' => { data_type => 'inet', }, 'left_port' => { data_type => 'text', }, 'left_descr' => { data_type => 'text', }, 'speed' => { data_type => 'text', }, 'right_ip' => { data_type => 'inet', }, 'right_port' => { data_type => 'text', }, 'right_descr' => { data_type => 'text', }, ); __PACKAGE__->has_many('left_vlans', 'App::Netdisco::DB::Result::DevicePortVlan', { 'foreign.ip' => 'self.left_ip', 'foreign.port' => 'self.left_port' }); __PACKAGE__->has_many('right_vlans', 'App::Netdisco::DB::Result::DevicePortVlan', { 'foreign.ip' => 'self.right_ip', 'foreign.port' => 'self.right_port' }); 1;