From: Arthur Axel 'fREW' Schmidt Date: Sat, 20 Mar 2010 17:04:08 +0000 (-0500) Subject: txn_Wrap for upgrades X-Git-Tag: v0.001000_01~83 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3249629f430cb0e5a7ef9504f530fbc01ae59fb5;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git txn_Wrap for upgrades --- diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 478f836..129000c 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -417,7 +417,10 @@ sub _downgrade_single_step { } $self->_filedata($self->_read_sql_file($upgrade_file)); # I don't like this --fREW 2010-02-22 - $self->schema->txn_do(sub { $self->_do_upgrade }); + + my $guard = $self->schema->txn_scope_guard if $self->txn_wrap; + $self->_do_upgrade; + $guard->commit if $self->txn_wrap; } } @@ -437,7 +440,9 @@ sub _upgrade_single_step { } $self->_filedata($self->_read_sql_file($upgrade_file)); # I don't like this --fREW 2010-02-22 - $self->schema->txn_do(sub { $self->_do_upgrade }); + my $guard = $self->schema->txn_scope_guard if $self->txn_wrap; + $self->_do_upgrade; + $guard->commit if $self->txn_wrap; } }