issue DB schema statements each within savepoints

This commit is contained in:
Oliver Gorwits
2018-05-09 06:07:30 +01:00
parent 3d27184b1c
commit d959adde36
4 changed files with 34 additions and 2 deletions

View 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;