rename ports column in device table to be num_ports

This commit is contained in:
Oliver Gorwits
2020-04-18 16:50:49 +01:00
parent 11e8d7c001
commit 4f57a4d30a
5 changed files with 17 additions and 4 deletions

View File

@@ -1,8 +1,14 @@
2.045002 - 2020-04-18
[BUG FIXES]
* rename ports column in device table to be num_ports
2.045001 - 2020-04-18
[BUG FIXES]
* restore port column in device table, needed for discovery
* restore ports column in device table to fix discover bug
2.045000 - 2020-04-15

View File

@@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces(
);
our # try to hide from kwalitee
$VERSION = 61; # schema version used for upgrades, keep as integer
$VERSION = 62; # schema version used for upgrades, keep as integer
use Path::Class;
use File::ShareDir 'dist_dir';

View File

@@ -35,7 +35,7 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 1 },
"layers",
{ data_type => "varchar", is_nullable => 1, size => 8 },
"ports",
"num_ports",
{ data_type => "integer", is_serializable => 0, is_nullable => 1 },
"mac",
{ data_type => "macaddr", is_nullable => 1 },

View File

@@ -35,7 +35,7 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
my @properties = qw/
snmp_ver
description uptime name
layers ports mac
layers mac
ps1_type ps2_type ps1_status ps2_status
fan slots
vendor os os_ver
@@ -51,7 +51,9 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
$device->set_column( contact => Encode::decode('UTF-8', $snmp->contact) );
$device->set_column( location => Encode::decode('UTF-8', $snmp->location) );
$device->set_column( num_ports => $snmp->ports );
$device->set_column( snmp_class => $snmp->class );
$device->set_column( last_discover => \'now()' );
schema('netdisco')->txn_do(sub {

View File

@@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE device RENAME COLUMN ports TO num_ports;
COMMIT;