From: Matt S Trout Date: Tue, 19 Jun 2007 17:58:03 +0000 (+0000) Subject: make errors during deploy soft X-Git-Tag: v0.08010~147 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61bf0de5e9a3fd3d13dd7a97c2e8fb857f9d53c5;p=dbsrgits%2FDBIx-Class.git make errors during deploy soft --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 20948f3..7d1ced1 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1403,16 +1403,21 @@ sub deployment_statements { sub deploy { my ($self, $schema, $type, $sqltargs, $dir) = @_; foreach my $statement ( $self->deployment_statements($schema, $type, undef, $dir, { no_comments => 1, %{ $sqltargs || {} } } ) ) { - for ( split(";\n", $statement)) { - next if($_ =~ /^--/); - next if(!$_); -# next if($_ =~ /^DROP/m); - next if($_ =~ /^BEGIN TRANSACTION/m); - next if($_ =~ /^COMMIT/m); - next if $_ =~ /^\s+$/; # skip whitespace only - $self->debugobj->query_start($_) if $self->debug; - $self->dbh->do($_); # shouldn't be using ->dbh ? - $self->debugobj->query_end($_) if $self->debug; + foreach my $line ( split(";\n", $statement)) { + next if($line =~ /^--/); + next if(!$line); +# next if($line =~ /^DROP/m); + next if($line =~ /^BEGIN TRANSACTION/m); + next if($line =~ /^COMMIT/m); + next if $line =~ /^\s+$/; # skip whitespace only + $self->debugobj->query_start($line) if $self->debug; + eval { + $self->dbh->do($line); # shouldn't be using ->dbh ? + }; + if ($@) { + warn qq{$@ (running "${line}")}; + } + $self->debugobj->query_end($line) if $self->debug; } } }