Clean up duplicate node entries on vlan 0

This commit is contained in:
Oliver Gorwits
2014-08-08 20:59:30 +01:00
parent b45c62003d
commit d604659716
4 changed files with 27 additions and 1 deletions

View File

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

View File

@@ -0,0 +1,17 @@
-- clean up node table where vlan = 0 and vlan = <another number>
--
-- DELETE n1.*
-- FROM node n1 INNER JOIN
-- (SELECT mac, switch, port from node
-- GROUP BY mac, switch, port
-- HAVING count(*) > 1) n2
-- ON n1.mac = n2.mac
-- AND n1.switch = n2.switch
-- AND n1.port = n2.port
-- AND n1.vlan = '0';
BEGIN;
DELETE n1.* FROM node n1 INNER JOIN (SELECT mac, switch, port from node GROUP BY mac, switch, port HAVING count(*) > 1) n2 ON n1.mac = n2.mac AND n1.switch = n2.switch AND n1.port = n2.port AND n1.vlan = '0';
COMMIT;

View File

@@ -38,6 +38,14 @@ but they are backwards compatible.
=head1 2.029000
=head2 Health Advice
This release will remove from the database spurious Node (workstation,
printer, etc) entries on vlan 0, which were causing dupliate entries in the
web interface. We advise that you back up the database prior to upgrade:
/usr/bin/pg_dump -F p --create -f netdisco-pgsql.dump netdisco
=head2 General Notices
The configuration item C<reports> is now a list (used to be a dictionary).