Clean up duplicate node entries on vlan 0
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
| @@ -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). | ||||
|   | ||||
		Reference in New Issue
	
	Block a user