X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FVersioned.pm;h=8b86e7a44a2bb51f8b0b54b4dd6b5815fe7b63c6;hb=70f3927877ba6b7aac2565bc1933daaf82361308;hp=ea662b311ad1976d266dde47462f191bc25ab13e;hpb=737416a49d249f9a77c1389c19ab77a1deabc60c;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema/Versioned.pm b/lib/DBIx/Class/Schema/Versioned.pm index ea662b3..8b86e7a 100644 --- a/lib/DBIx/Class/Schema/Versioned.pm +++ b/lib/DBIx/Class/Schema/Versioned.pm @@ -60,6 +60,13 @@ sub schema_version { return $version; } +sub connection { + my $self = shift; + $self->next::method(@_); + $self->_on_connect; + return $self; +} + sub _on_connect { my ($self) = @_; @@ -67,7 +74,7 @@ sub _on_connect my $vtable = $vschema->resultset('Table'); my $pversion; - if(!$self->exists($vtable)) + if(!$self->_source_exists($vtable)) { # $vschema->storage->debug(1); $vschema->storage->ensure_connected(); @@ -146,7 +153,7 @@ sub _on_connect # $self->upgrade($pversion, $self->schema_version); } -sub exists +sub _source_exists { my ($self, $rs) = @_; @@ -198,9 +205,9 @@ sub run_upgrade for (@statements) { - $self->storage->debugfh->print("$_\n") if $self->storage->debug; -# print "Running \n>>$_<<\n"; + $self->storage->debugobj->query_start($_) if $self->storage->debug; $self->storage->dbh->do($_) or warn "SQL was:\n $_"; + $self->storage->debugobj->query_end($_) if $self->storage->debug; } return 1;