separated upgrade statement execution to new method
Luke Saunders [Thu, 7 Aug 2008 18:35:52 +0000 (18:35 +0000)]
lib/DBIx/Class/Schema/Versioned.pm

index 31ff7b1..44e0172 100644 (file)
@@ -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