to SQL::Translator (partially RT#87731)
- Fix SQLT constraint naming when DBIC table names are fully qualified
(PR#48)
+ - Ensure ::Schema::Versioned connects only once by reusing the main
+ connection (GH#57)
- Fix inability to handle multiple consecutive transactions with
savepoints on DBD::SQLite < 1.39
- Fix CDBICompat to match Class::DBI behavior handling non-result
jegade: Jens Gassmann <jens.gassmann@atomix.de>
+jeneric: Eric A. Miller <emiller@cpan.org>
+
jesper: Jesper Krogh
jgoulah: John Goulah <jgoulah@cpan.org>
use DBIx::Class::Carp;
use Time::HiRes qw/gettimeofday/;
use Try::Tiny;
+use Scalar::Util 'weaken';
use namespace::clean;
__PACKAGE__->mk_classdata('_filedata');
{
my ($self) = @_;
- my $conn_info = $self->storage->connect_info;
- $self->{vschema} = DBIx::Class::Version->connect(@$conn_info);
- my $conn_attrs = $self->{vschema}->storage->_dbic_connect_attributes || {};
+ weaken (my $w_self = $self );
+
+ $self->{vschema} = DBIx::Class::Version->connect(sub { $w_self->storage->dbh });
+ my $conn_attrs = $self->storage->_dbic_connect_attributes || {};
my $vtable = $self->{vschema}->resultset('Table');
# check for legacy versions table and move to new if exists
unless ($self->_source_exists($vtable)) {
- my $vtable_compat = DBIx::Class::VersionCompat->connect(@$conn_info)->resultset('TableCompat');
+ my $vtable_compat = DBIx::Class::VersionCompat->connect(sub { $w_self->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;
ok($get_db_version_run == 0, "attributes pulled from list connect_info");
}
+# at this point we have v1, v2 and v3 still connected
+# make sure they are the only connections and everything else is gone
+is
+ scalar( grep
+ { defined $_ and $_->{Active} }
+ map
+ { @{$_->{ChildHandles}} }
+ values %{ { DBI->installed_drivers } }
+ ), 3, "Expected number of connections at end of script"
+;
+
END {
unless ($ENV{DBICTEST_KEEP_VERSIONING_DDL}) {
$ddl_dir->rmtree;