[Bast-commits] r9388 - in DBIx-Class/0.08/trunk: .
lib/DBIx/Class/Schema t
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Sun May 16 10:28:13 GMT 2010
Author: ash
Date: 2010-05-16 11:28:13 +0100 (Sun, 16 May 2010)
New Revision: 9388
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm
DBIx-Class/0.08/trunk/t/94versioning.t
Log:
Fix how Schema::Versioned gets connection attributes
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2010-05-16 09:43:40 UTC (rev 9387)
+++ DBIx-Class/0.08/trunk/Changes 2010-05-16 10:28:13 UTC (rev 9388)
@@ -26,6 +26,7 @@
- update() on row not in_storage no longer throws an exception
if there are no dirty columns to update (fixes cascaded update
annoyances)
+ - Update Schema::Versioned to respect hashref style of connection_info
0.08121 2010-04-11 18:43:00 (UTC)
- Support for Firebird RDBMS with DBD::InterBase and ODBC
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm 2010-05-16 09:43:40 UTC (rev 9387)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm 2010-05-16 10:28:13 UTC (rev 9388)
@@ -558,24 +558,25 @@
sub connection {
my $self = shift;
$self->next::method(@_);
- $self->_on_connect($_[3]);
+ $self->_on_connect();
return $self;
}
sub _on_connect
{
- my ($self, $args) = @_;
+ my ($self) = @_;
- $args = {} unless $args;
+ my $info = $self->storage->connect_info;
+ my $args = $info->[-1];
- $self->{vschema} = DBIx::Class::Version->connect(@{$self->storage->connect_info()});
+ $self->{vschema} = DBIx::Class::Version->connect(@$info);
my $vtable = $self->{vschema}->resultset('Table');
# useful when connecting from scripts etc
return if ($args->{ignore_version} || ($ENV{DBIC_NO_VERSION_CHECK} && !exists $args->{ignore_version}));
# check for legacy versions table and move to new if exists
- my $vschema_compat = DBIx::Class::VersionCompat->connect(@{$self->storage->connect_info()});
+ my $vschema_compat = DBIx::Class::VersionCompat->connect(@$info);
unless ($self->_source_exists($vtable)) {
my $vtable_compat = $vschema_compat->resultset('TableCompat');
if ($self->_source_exists($vtable_compat)) {
Modified: DBIx-Class/0.08/trunk/t/94versioning.t
===================================================================
--- DBIx-Class/0.08/trunk/t/94versioning.t 2010-05-16 09:43:40 UTC (rev 9387)
+++ DBIx-Class/0.08/trunk/t/94versioning.t 2010-05-16 10:28:13 UTC (rev 9388)
@@ -245,6 +245,33 @@
is($schema_v2->get_db_version(), '3.0', 'Fast deploy/upgrade');
};
+# Check that it Schema::Versioned deals with new/all forms of connect arguments.
+{
+ my $get_db_version_run = 0;
+
+ no warnings qw/once redefine/;
+ local *DBIx::Class::Schema::Versioned::get_db_version = sub {
+ $get_db_version_run = 1;
+ return $_[0]->schema_version;
+ };
+
+ # Make sure the env var isn't whats triggering it
+ local $ENV{DBIC_NO_VERSION_CHECK} = 0;
+
+ DBICVersion::Schema->connect({
+ dsn => $dsn,
+ user => $user,
+ pass => $pass,
+ ignore_version => 1
+ });
+
+ ok($get_db_version_run == 0, "attributes pulled from hashref connect_info");
+ $get_db_version_run = 0;
+
+ DBICVersion::Schema->connect( $dsn, $user, $pass, { ignore_version => 1 } );
+ ok($get_db_version_run == 0, "attributes pulled from list connect_info");
+}
+
unless ($ENV{DBICTEST_KEEP_VERSIONING_DDL}) {
unlink $_ for (values %$fn);
}
More information about the Bast-commits
mailing list