From: Arthur Axel 'fREW' Schmidt Date: Thu, 25 Feb 2010 04:57:13 +0000 (-0600) Subject: finally put deploy where it actually belongs X-Git-Tag: v0.001000_01~124 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f50d101838b1cb69f53128fa658b6039bd0d3ce;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git finally put deploy where it actually belongs --- diff --git a/lib/DBIx/Class/DeploymentHandler.pm b/lib/DBIx/Class/DeploymentHandler.pm index b325716..988adc1 100644 --- a/lib/DBIx/Class/DeploymentHandler.pm +++ b/lib/DBIx/Class/DeploymentHandler.pm @@ -86,38 +86,6 @@ has sqltargs => ( # configuration default => sub { {} }, ); -method deploy { - my $storage = $self->storage; - - my $deploy = sub { - my $line = shift; - # the \nCOMMIT below is entirely to make the tests quieter, - # there is surely a better way to fix it (/m breaks everything) - return if(!$line || $line =~ /^(--|BEGIN TRANSACTION|\nCOMMIT|\s+$)/); - $storage->_query_start($line); - try { - # do a dbh_do cycle here, as we need some error checking in - # place (even though we will ignore errors) - $storage->dbh_do (sub { $_[1]->do($line) }); - } - catch { - carp "$_ (running '${line}')" - } - $storage->_query_end($line); - }; - my @statements = $self->deployment_statements; - if (@statements > 1) { - foreach my $statement (@statements) { - $deploy->( $statement ); - } - } - elsif (@statements == 1) { - foreach my $line ( split(";\n", $statements[0])) { - $deploy->( $line ); - } - } -} - method install($new_version) { carp 'Install not possible as versions table already exists in database' if $self->is_installed; diff --git a/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm index 1ba0e72..255bdfd 100644 --- a/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/SqltDeployMethod.pm @@ -1,6 +1,7 @@ package DBIx::Class::DeploymentHandler::SqltDeployMethod; use Moose; use Method::Signatures::Simple; +use Try::Tiny; use Carp 'carp'; @@ -115,10 +116,6 @@ method deployment_statements { } method deploy { - my $schema = $self->schema; - my $type = undef; - my $sqltargs = $self->sqltargs; - my $dir = $self->upgrade_directory; my $storage = $self->storage; my $deploy = sub { diff --git a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm index 79b97fb..55f7c05 100644 --- a/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm +++ b/lib/DBIx/Class/DeploymentHandler/WithSqltDeployMethod.pm @@ -11,6 +11,7 @@ has deploy_method => ( lazy_build => 1, handles => [qw{ deployment_statements + deploy create_install_ddl create_update_ddl create_ddl_dir