my ($v) = $real_ver =~ /([1-9])/;
$v = "v$v";
- last if $v eq CURRENT_V;
+ last if $v eq CURRENT_V || $real_ver =~ /^0\.04999/;
if (not %{ $self->naming }) {
warn <<"EOF" unless $ENV{SCHEMA_LOADER_BACKCOMPAT};
'hardcode' => sub {
package DBICTest::Schema::5;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connection($make_dbictest_db::dsn);
__PACKAGE__;
},
package DBICTest::Schema::6;
use base qw/ DBIx::Class::Schema::Loader /;
__PACKAGE__->loader_options();
+ __PACKAGE__->naming('current');
__PACKAGE__->connect($make_dbictest_db::dsn);
},
'make_schema_at' => sub {
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
'DBICTest::Schema::7',
- { really_erase_my_files => 1 },
+ { really_erase_my_files => 1, naming => 'current' },
[ $make_dbictest_db::dsn ],
);
DBICTest::Schema::7->clone;
'embedded_options' => sub {
package DBICTest::Schema::8;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connect(
$make_dbictest_db::dsn,
{ loader_options => { really_erase_my_files => 1 } }
'embedded_options_in_attrs' => sub {
package DBICTest::Schema::9;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connect(
$make_dbictest_db::dsn,
undef,
{ },
[
$make_dbictest_db::dsn,
- { loader_options => { really_erase_my_files => 1 } },
+ { loader_options => {
+ really_erase_my_files => 1,
+ naming => 'current'
+ } },
],
);
"DBICTest::Schema::10";
'almost_embedded' => sub {
package DBICTest::Schema::11;
use base qw/ DBIx::Class::Schema::Loader /;
- __PACKAGE__->loader_options( really_erase_my_files => 1 );
+ __PACKAGE__->loader_options(
+ really_erase_my_files => 1,
+ naming => 'current'
+ );
__PACKAGE__->connect(
$make_dbictest_db::dsn,
undef, undef, { AutoCommit => 1 }
use DBIx::Class::Schema::Loader;
DBIx::Class::Schema::Loader::make_schema_at(
'DBICTest::Schema::12',
- { really_erase_my_files => 1 },
+ { really_erase_my_files => 1, naming => 'current' },
[ $make_dbictest_db::dsn ],
);
DBICTest::Schema::12->clone;
loader_class => sub {
package DBICTest::Schema::1;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->loader_class(shift);
__PACKAGE__->connect($make_dbictest_db::dsn);
},
connect_info => sub {
package DBICTeset::Schema::2;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connect($make_dbictest_db::dsn, { loader_class => shift });
},
make_schema_at => sub {
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
'DBICTeset::Schema::3',
- { },
+ { naming => 'current' },
[ $make_dbictest_db::dsn, { loader_class => shift } ]
);
}
plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests'
unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT};
+local $SIG{__WARN__} = sub {
+ warn @_ unless $_[0] =~ /Dynamic schema|really_erase_my_files/;
+};
+
# Takes a $schema as input, runs 4 basic tests
sub test_schema {
my ($testname, $schema) = @_;
my $dump_path = './t/_dump';
+local $SIG{__WARN__} = sub {
+ warn @_ unless $_[0] =~
+ /^Dumping manual schema|really_erase_my_files|^Schema dump complete/;
+};
+
{
package DBICTest::Schema::1;
use base qw/ DBIx::Class::Schema::Loader /;
my $warn_count = 0;
$warn_count++ if grep /ResultSetManager/, @loader_warnings;
+ $warn_count++ if grep /Dynamic schema detected/, @loader_warnings;
if($self->{skip_rels}) {
is(scalar(@loader_warnings), $warn_count)
q{ INSERT INTO loader_test30 (id,loader_test2) VALUES(321, 2) },
);
- my $dbh = $self->dbconnect(1);
- $dbh->do($_) for @statements_rescan;
- $dbh->disconnect;
+ {
+ # Silence annoying but harmless postgres "NOTICE: CREATE TABLE..."
+ local $SIG{__WARN__} = sub {
+ my $msg = shift;
+ warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
+ };
+
+ my $dbh = $self->dbconnect(1);
+ $dbh->do($_) for @statements_rescan;
+ $dbh->disconnect;
+ }
my @new = $conn->rescan;
is(scalar(@new), 1);
# Silence annoying but harmless postgres "NOTICE: CREATE TABLE..."
local $SIG{__WARN__} = sub {
my $msg = shift;
- print STDERR $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
+ warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
};
$dbh->do($_) for (@statements);