From: Peter Rabbitson Date: Thu, 14 Apr 2016 08:34:30 +0000 (+0200) Subject: Remove one level of indirection in Versioned on_connect X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f03d3e5d811528804fb55d900eff059760b8b8cc;p=dbsrgits%2FDBIx-Class-Historic.git Remove one level of indirection in Versioned on_connect No functional changes --- diff --git a/lib/DBIx/Class/Schema/Versioned.pm b/lib/DBIx/Class/Schema/Versioned.pm index c155360..eb4fe65 100644 --- a/lib/DBIx/Class/Schema/Versioned.pm +++ b/lib/DBIx/Class/Schema/Versioned.pm @@ -589,10 +589,10 @@ sub _on_connect { my ($self) = @_; - weaken (my $w_self = $self ); + weaken (my $w_storage = $self->storage ); - $self->{vschema} = DBIx::Class::Version->connect(sub { $w_self->storage->dbh }); - my $conn_attrs = $self->storage->_dbic_connect_attributes || {}; + $self->{vschema} = DBIx::Class::Version->connect(sub { $w_storage->dbh }); + my $conn_attrs = $w_storage->_dbic_connect_attributes || {}; my $vtable = $self->{vschema}->resultset('Table'); @@ -601,11 +601,11 @@ sub _on_connect # check for legacy versions table and move to new if exists unless ($self->_source_exists($vtable)) { - my $vtable_compat = DBIx::Class::VersionCompat->connect(sub { $w_self->storage->dbh })->resultset('TableCompat'); + my $vtable_compat = DBIx::Class::VersionCompat->connect(sub { $w_storage->dbh })->resultset('TableCompat'); if ($self->_source_exists($vtable_compat)) { $self->{vschema}->deploy; map { $vtable->new_result({ installed => $_->Installed, version => $_->Version })->insert } $vtable_compat->all; - $self->storage->_get_dbh->do("DROP TABLE " . $vtable_compat->result_source->from); + $w_storage->_get_dbh->do("DROP TABLE " . $vtable_compat->result_source->from); } }