[#199] Missing schema changes when user has no permissions on DB
This fixes many glitches with the schema deployment: - silently ignoring real failure modes such as user not having correct permissions on the DB - a couple of broken upgrade steps - adds --reset so schema can be fully redeployed
This commit is contained in:
@@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces(
|
||||
);
|
||||
|
||||
our # try to hide from kwalitee
|
||||
$VERSION = 39; # schema version used for upgrades, keep as integer
|
||||
$VERSION = 40; # schema version used for upgrades, keep as integer
|
||||
|
||||
use Path::Class;
|
||||
use File::Basename;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE admin DROP CONSTRAINT IF EXISTS admin_pkey;
|
||||
|
||||
ALTER TABLE admin ADD PRIMARY KEY (job);
|
||||
|
||||
COMMIT;
|
||||
|
||||
@@ -12,6 +12,4 @@
|
||||
|
||||
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;
|
||||
|
||||
@@ -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 FROM node AS n1 USING (SELECT mac, switch, port from node GROUP BY mac, switch, port HAVING count(*) > 1) n2 WHERE n1.mac = n2.mac AND n1.switch = n2.switch AND n1.port = n2.port AND n1.vlan = '0';
|
||||
|
||||
COMMIT;
|
||||
@@ -177,6 +177,13 @@ following commands into a shell script and call it nightly from C<cron>:
|
||||
This will keep 30 days of backups. You don't need to stop Netdisco during the
|
||||
backup.
|
||||
|
||||
=head1 Database Schema Redeployment
|
||||
|
||||
The database schema can be fully redeployed (even over an existing
|
||||
installation, in a safe way) using the following command:
|
||||
|
||||
~netdisco/bin/netdisco-db-deploy --reset
|
||||
|
||||
=head1 Further Reading...
|
||||
|
||||
Other ways to run and host the web application can be found in the
|
||||
|
||||
@@ -36,7 +36,25 @@ but they are backwards compatible.
|
||||
|
||||
=back
|
||||
|
||||
=head1 2.031000
|
||||
=head1 2.031003
|
||||
|
||||
=head2 Health Advice
|
||||
|
||||
This release will I<once again> 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
|
||||
|
||||
=head1 2.031003
|
||||
|
||||
The database schema can be fully redeployed (even over an existing
|
||||
installation, in a safe way) using the following command:
|
||||
|
||||
~netdisco/bin/netdisco-db-deploy --reset
|
||||
|
||||
=head2 General Notices
|
||||
|
||||
|
||||
Reference in New Issue
Block a user