From: Luke Saunders Date: Thu, 7 Aug 2008 18:35:52 +0000 (+0000) Subject: separated upgrade statement execution to new method X-Git-Tag: v0.08240~380 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=abc8f12a6852a8615a74d645bcd9b435f2e15e46;p=dbsrgits%2FDBIx-Class.git separated upgrade statement execution to new method --- diff --git a/lib/DBIx/Class/Schema/Versioned.pm b/lib/DBIx/Class/Schema/Versioned.pm index 31ff7b1..44e0172 100644 --- a/lib/DBIx/Class/Schema/Versioned.pm +++ b/lib/DBIx/Class/Schema/Versioned.pm @@ -350,13 +350,26 @@ sub run_upgrade for (@statements) { $self->storage->debugobj->query_start($_) if $self->storage->debug; - $self->storage->dbh->do($_) or warn "SQL was:\n $_"; + $self->apply_statement($_); $self->storage->debugobj->query_end($_) if $self->storage->debug; } return 1; } +=head2 apply_statement + +Takes an SQL statement and runs it. Override this if you want to handle errors +differently. + +=cut + +sub apply_statement { + my ($self, $statement) = @_; + + $self->storage->dbh->do($_) or warn "SQL was:\n $_"; +} + =head2 get_db_version Returns the version that your database is currently at. This is determined by the values in the