From 786977354b0e63883b42ba44a89f2410bc79400f Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 11 Mar 2013 22:54:21 +0000 Subject: [PATCH] add VIEW for duplex mismatches --- .../DB/Result/Virtual/DuplexMismatch.pm | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Netdisco/lib/App/Netdisco/DB/Result/Virtual/DuplexMismatch.pm diff --git a/Netdisco/lib/App/Netdisco/DB/Result/Virtual/DuplexMismatch.pm b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/DuplexMismatch.pm new file mode 100644 index 00000000..a886e91e --- /dev/null +++ b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/DuplexMismatch.pm @@ -0,0 +1,58 @@ +package App::Netdisco::DB::Result::Virtual::DuplexMismatch; + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +__PACKAGE__->table_class('DBIx::Class::ResultSource::View'); + +__PACKAGE__->table('duplex_mismatch'); +__PACKAGE__->result_source_instance->is_virtual(1); +__PACKAGE__->result_source_instance->view_definition(< dp2.duplex + AND dp.ip <= di.ip + ORDER BY dp.ip +ENDSQL +); + +__PACKAGE__->add_columns( + 'left_ip' => { + data_type => 'inet', + }, + 'left_dns' => { + data_type => 'text', + }, + 'left_port' => { + data_type => 'text', + }, + 'left_duplex' => { + data_type => 'text', + }, + 'right_ip' => { + data_type => 'inet', + }, + 'right_dns' => { + data_type => 'text', + }, + 'right_port' => { + data_type => 'text', + }, + 'right_duplex' => { + data_type => 'text', + }, +); + +1;