issue DB schema statements each within savepoints
This commit is contained in:
2
Changes
2
Changes
@@ -5,10 +5,12 @@
|
|||||||
* #408 improvements to MakeRancidConf (earendilfr)
|
* #408 improvements to MakeRancidConf (earendilfr)
|
||||||
* #410 improvements to Undiscovered Neighbors report
|
* #410 improvements to Undiscovered Neighbors report
|
||||||
* device port search will match on Description as well as Port
|
* device port search will match on Description as well as Port
|
||||||
|
* issue DB schema statements each within savepoints
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
* #414 clicking discover button with empty field causes crash
|
* #414 clicking discover button with empty field causes crash
|
||||||
|
* #415 neighbors map display is blank
|
||||||
|
|
||||||
2.039028 - 2018-05-05
|
2.039028 - 2018-05-05
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces(
|
|||||||
);
|
);
|
||||||
|
|
||||||
our # try to hide from kwalitee
|
our # try to hide from kwalitee
|
||||||
$VERSION = 52; # schema version used for upgrades, keep as integer
|
$VERSION = 53; # schema version used for upgrades, keep as integer
|
||||||
|
|
||||||
use Path::Class;
|
use Path::Class;
|
||||||
use File::ShareDir 'dist_dir';
|
use File::ShareDir 'dist_dir';
|
||||||
@@ -20,7 +20,7 @@ our $schema_versions_dir = Path::Class::Dir->new( dist_dir('App-Netdisco') )
|
|||||||
->subdir('schema_versions')->stringify;
|
->subdir('schema_versions')->stringify;
|
||||||
|
|
||||||
__PACKAGE__->load_components(qw/
|
__PACKAGE__->load_components(qw/
|
||||||
Schema::Versioned
|
+App::Netdisco::DB::SchemaVersioned
|
||||||
+App::Netdisco::DB::ExplicitLocking
|
+App::Netdisco::DB::ExplicitLocking
|
||||||
/);
|
/);
|
||||||
|
|
||||||
|
|||||||
17
lib/App/Netdisco/DB/SchemaVersioned.pm
Normal file
17
lib/App/Netdisco/DB/SchemaVersioned.pm
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package App::Netdisco::DB::SchemaVersioned;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use base 'DBIx::Class::Schema::Versioned';
|
||||||
|
|
||||||
|
use Try::Tiny;
|
||||||
|
use DBIx::Class::Carp;
|
||||||
|
|
||||||
|
sub apply_statement {
|
||||||
|
my ($self, $statement) = @_;
|
||||||
|
try { $self->storage->txn_do(sub { $self->storage->dbh->do($statement) }) }
|
||||||
|
catch { carp "SQL was: $statement" if $ENV{DBIC_TRACE} };
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
13
share/schema_versions/App-Netdisco-DB-52-53-PostgreSQL.sql
Normal file
13
share/schema_versions/App-Netdisco-DB-52-53-PostgreSQL.sql
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE netmap_positions DROP CONSTRAINT "netmap_positions_device_groups_vlan_key";
|
||||||
|
|
||||||
|
ALTER TABLE netmap_positions RENAME COLUMN device_groups TO host_groups;
|
||||||
|
|
||||||
|
ALTER TABLE netmap_positions ALTER COLUMN host_groups SET DEFAULT '{}';
|
||||||
|
|
||||||
|
ALTER TABLE netmap_positions ADD COLUMN "device" inet;
|
||||||
|
|
||||||
|
ALTER TABLE netmap_positions ADD COLUMN "locations" text[] DEFAULT '{}' NOT NULL;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
Reference in New Issue
Block a user