Revision history for Perl extension DBIx::Class::Schema::Loader
+ - automatically prefix database/schema to clashing monikers for
+ the same table name in multischema configurations
+
0.07012 2011-11-09 15:16:29
- as of 0.07011 all callbacks receive a ::Loader::Table or
interface-compatible object instead of the table name, this object
use Try::Tiny;
use DBIx::Class ();
use Encode qw/encode decode/;
-use List::MoreUtils qw/all firstidx/;
+use List::MoreUtils qw/all any firstidx uniq/;
use File::Temp 'tempfile';
use namespace::clean;
for all owners in all databases.
-You may need to control naming of monikers with L</moniker_parts> if you have
-name clashes for tables in different schemas/databases.
+Name clashes resulting from the same table name in different databases/schemas
+will be resolved automatically by prefixing the moniker with the database
+and/or schema.
+
+To prefix/suffix all monikers with the database and/or schema, see
+L</moniker_parts>.
=head2 moniker_parts
sub _load_tables {
my ($self, @tables) = @_;
- # Save the new tables to the tables list
+ # Save the new tables to the tables list and compute monikers
foreach (@tables) {
- $self->_tables->{$_->sql_name} = $_;
+ $self->_tables->{$_->sql_name} = $_;
+ $self->monikers->{$_->sql_name} = $self->_table2moniker($_);
}
- $self->_make_src_class($_) for @tables;
-
- # sanity-check for moniker clashes
+ # check for moniker clashes
my $inverse_moniker_idx;
foreach my $table (values %{ $self->_tables }) {
- push @{ $inverse_moniker_idx->{$self->monikers->{$table->sql_name}} }, $table;
+ push @{ $inverse_moniker_idx->{$self->monikers->{$table->sql_name}} }, $table;
}
my @clashes;
foreach my $moniker (keys %$inverse_moniker_idx) {
- my $tables = $inverse_moniker_idx->{$moniker};
- if (@$tables > 1) {
- push @clashes, sprintf ("tables %s reduced to the same source moniker '%s'",
- join (', ', map $_->sql_name, @$tables),
- $moniker,
- );
- }
+ my $tables = $inverse_moniker_idx->{$moniker};
+ if (@$tables > 1) {
+ my $different_databases =
+ $tables->[0]->can('database') && (uniq map $_->database||'', @$tables) > 1;
+
+ my $different_schemas =
+ (uniq map $_->schema||'', @$tables) > 1;
+
+ if ($different_databases || $different_schemas) {
+ my ($use_schema, $use_database) = (1, 0);
+
+ if ($different_databases) {
+ $use_database = 1;
+
+ # If any monikers are in the same database, we have to distinguish by
+ # both schema and database.
+ my %db_counts;
+ $db_counts{$_}++ for map $_->database, @$tables;
+ $use_schema = any { $_ > 1 } values %db_counts;
+ }
+
+ delete $self->monikers->{$_->sql_name} for @$tables;
+
+ my $moniker_parts = $self->{moniker_parts};
+
+ my $have_schema = 1 if any { $_ eq 'schema' } @{ $self->moniker_parts };
+ my $have_database = 1 if any { $_ eq 'database' } @{ $self->moniker_parts };
+
+ unshift @$moniker_parts, 'schema' if $use_schema && !$have_schema;
+ unshift @$moniker_parts, 'database' if $use_database && !$have_database;
+
+ local $self->{moniker_parts} = $moniker_parts;
+
+ my %new_monikers;
+
+ $new_monikers{$_->sql_name} = $self->_table2moniker($_) for @$tables;
+
+ $self->monikers->{$_} = $new_monikers{$_} for map $_->sql_name, @$tables;
+
+ # check if there are still clashes
+ my %by_moniker;
+
+ while (my ($t, $m) = each %new_monikers) {
+ push @{ $by_moniker{$m} }, $t;
+ }
+
+ foreach my $m (grep @{ $by_moniker{$_} } > 1, keys %by_moniker) {
+ push @clashes, sprintf ("tried disambiguating by moniker_parts, but tables %s still reduced to the same source moniker '%s'",
+ join (', ', @{ $by_moniker{$m} }),
+ $m,
+ );
+ }
+ }
+ else {
+ push @clashes, sprintf ("tables %s reduced to the same source moniker '%s'",
+ join (', ', map $_->sql_name, @$tables),
+ $moniker,
+ );
+ }
+ }
}
if (@clashes) {
- die 'Unable to load schema - chosen moniker/class naming style results in moniker clashes. '
- . 'In multi db_schema configurations you may need to set moniker_parts, '
- . 'otherwise change the naming style, or supply an explicit moniker_map: '
- . join ('; ', @clashes)
- . "\n"
- ;
+ die 'Unable to load schema - chosen moniker/class naming style results in moniker clashes. '
+ . 'Change the naming style, or supply an explicit moniker_map: '
+ . join ('; ', @clashes)
+ . "\n"
+ ;
}
+ $self->_make_src_class($_) for @tables;
+
$self->_setup_src_meta($_) for @tables;
if(!$self->skip_relationships) {
my $schema = $self->schema;
my $schema_class = $self->schema_class;
- my $table_moniker = $self->_table2moniker($table);
+ my $table_moniker = $self->monikers->{$table->sql_name};
my @result_namespace = ($schema_class);
if ($self->use_namespaces) {
my $result_namespace = $self->result_namespace || 'Result';
}
$self->classes->{$table->sql_name} = $table_class;
- $self->monikers->{$table->sql_name} = $table_moniker;
$self->moniker_to_table->{$table_moniker} = $table;
$self->class_to_table->{$table_class} = $table;
$dbh->do('CREATE DATABASE `dbicsl-test`');
}
catch {
+ diag "CREATE DATABASE returned error: '$_'";
skip "no CREATE DATABASE privileges", 30 * 2;
};
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => ['schema', 'name'],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
} 'connected test schema';
lives_and {
- ok $rsrc = $test_schema->source('DbicslDashTestMysqlLoaderTest4');
+ ok $rsrc = $test_schema->source('MysqlLoaderTest4');
} 'got source for table in database name with dash';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database name with dash';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDashTestMysqlLoaderTest4');
+ ok $rs = $test_schema->resultset('MysqlLoaderTest4');
} 'got resultset for table in database name with dash';
lives_and {
'unique constraint is correct in database name with dash');
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestMysqlLoaderTest6');
+ ok $rsrc = $test_schema->source('MysqlLoaderTest6');
} 'got source for table in database name with dot';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database name with dot introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDotTestMysqlLoaderTest6');
+ ok $rs = $test_schema->resultset('MysqlLoaderTest6');
} 'got resultset for table in database name with dot';
lives_and {
}
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestMysqlLoaderTest7');
+ ok $rsrc = $test_schema->source('MysqlLoaderTest7');
} 'got source for table in database name with dot';
%uniqs = try { $rsrc->unique_constraints };
skip 'set the environment variable DBICTEST_MYSQL_INNODB=1 to test relationships', 4 unless $test_innodb;
lives_and {
- ok $test_schema->source('DbicslDotTestMysqlLoaderTest6')
+ ok $test_schema->source('MysqlLoaderTest6')
->has_relationship('mysql_loader_test4');
} 'cross-database relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestMysqlLoaderTest4')
+ ok $test_schema->source('MysqlLoaderTest4')
->has_relationship('mysql_loader_test6s');
} 'cross-database relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestMysqlLoaderTest8')
+ ok $test_schema->source('MysqlLoaderTest8')
->has_relationship('mysql_loader_test7');
} 'cross-database relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDotTestMysqlLoaderTest7')
+ ok $test_schema->source('MysqlLoaderTest7')
->has_relationship('mysql_loader_test8s');
} 'cross-database relationship in multi-db_schema';
}
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/schema name/],
preserve_case => 1,
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
} 'connected test schema';
lives_and {
- ok $rsrc = $test_schema->source('DbicslDashTestPgLoaderTest4');
+ ok $rsrc = $test_schema->source('PgLoaderTest4');
} 'got source for table in schema name with dash';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema name with dash';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDashTestPgLoaderTest4');
+ ok $rs = $test_schema->resultset('PgLoaderTest4');
} 'got resultset for table in schema name with dash';
lives_and {
'unique constraint is correct in schema name with dash');
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestPgLoaderTest6');
+ ok $rsrc = $test_schema->source('PgLoaderTest6');
} 'got source for table in schema name with dot';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema name with dot introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDotTestPgLoaderTest6');
+ ok $rs = $test_schema->resultset('PgLoaderTest6');
} 'got resultset for table in schema name with dot';
lives_and {
'relationship in schema name with dot';
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestPgLoaderTest7');
+ ok $rsrc = $test_schema->source('PgLoaderTest7');
} 'got source for table in schema name with dot';
%uniqs = try { $rsrc->unique_constraints };
'unique constraint is correct in schema name with dot');
lives_and {
- ok $test_schema->source('DbicslDotTestPgLoaderTest6')
+ ok $test_schema->source('PgLoaderTest6')
->has_relationship('pg_loader_test4');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestPgLoaderTest4')
+ ok $test_schema->source('PgLoaderTest4')
->has_relationship('pg_loader_test6s');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestPgLoaderTest8')
+ ok $test_schema->source('PgLoaderTest8')
->has_relationship('pg_loader_test7');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDotTestPgLoaderTest7')
+ ok $test_schema->source('PgLoaderTest7')
->has_relationship('pg_loader_test8s');
} 'cross-schema relationship in multi-db_schema';
}
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/schema name/],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
} 'connected test schema';
lives_and {
- ok $rsrc = $test_schema->source('DbicslDashTestDb2LoaderTest4');
+ ok $rsrc = $test_schema->source('Db2LoaderTest4');
} 'got source for table in schema name with dash';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema name with dash';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDashTestDb2LoaderTest4');
+ ok $rs = $test_schema->resultset('Db2LoaderTest4');
} 'got resultset for table in schema name with dash';
lives_and {
'correct unique constraint in schema name with dash');
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestDb2LoaderTest6');
+ ok $rsrc = $test_schema->source('Db2LoaderTest6');
} 'got source for table in schema name with dot';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema name with dot introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDotTestDb2LoaderTest6');
+ ok $rs = $test_schema->resultset('Db2LoaderTest6');
} 'got resultset for table in schema name with dot';
lives_and {
'relationship in schema name with dot';
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestDb2LoaderTest7');
+ ok $rsrc = $test_schema->source('Db2LoaderTest7');
} 'got source for table in schema name with dot';
%uniqs = try { $rsrc->unique_constraints };
'correct unique constraint in schema name with dot');
lives_and {
- ok $test_schema->source('DbicslDotTestDb2LoaderTest6')
+ ok $test_schema->source('Db2LoaderTest6')
->has_relationship('db2_loader_test4');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestDb2LoaderTest4')
+ ok $test_schema->source('Db2LoaderTest4')
->has_relationship('db2_loader_test6s');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestDb2LoaderTest8')
+ ok $test_schema->source('Db2LoaderTest8')
->has_relationship('db2_loader_test7');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDotTestDb2LoaderTest7')
+ ok $test_schema->source('Db2LoaderTest7')
->has_relationship('db2_loader_test8s');
} 'cross-schema relationship in multi-db_schema';
}
my $schema2_moniker = join '', map ucfirst lc, split_name to_identifier $schema2;
my %monikers;
- $monikers{'1.4'} = $schema1_moniker . 'OracleLoaderTest4';
$monikers{'1.5'} = $schema1_moniker . 'OracleLoaderTest5';
$monikers{'2.5'} = $schema2_moniker . 'OracleLoaderTest5';
- $monikers{'2.6'} = $schema2_moniker . 'OracleLoaderTest6';
- $monikers{'2.7'} = $schema2_moniker . 'OracleLoaderTest7';
- $monikers{'1.8'} = $schema1_moniker . 'OracleLoaderTest8';
foreach my $db_schema ([$schema1, $schema2], '%') {
lives_and {
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/schema name/],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
} 'connected test schema';
lives_and {
- ok $rsrc = $test_schema->source($monikers{'1.4'});
+ ok $rsrc = $test_schema->source('OracleLoaderTest4');
} 'got source for table in schema1';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema1';
lives_and {
- ok $rs = $test_schema->resultset($monikers{'1.4'});
+ ok $rs = $test_schema->resultset('OracleLoaderTest4');
} 'got resultset for table in schema1';
lives_and {
'correct unique constraint in schema1');
lives_and {
- ok $rsrc = $test_schema->source($monikers{'2.6'});
+ ok $rsrc = $test_schema->source('OracleLoaderTest6');
} 'got source for table in schema2';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema2 introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset($monikers{'2.6'});
+ ok $rs = $test_schema->resultset('OracleLoaderTest6');
} 'got resultset for table in schema2';
lives_and {
'relationship in schema2';
lives_and {
- ok $rsrc = $test_schema->source($monikers{'2.7'});
+ ok $rsrc = $test_schema->source('OracleLoaderTest7');
} 'got source for table in schema2';
%uniqs = try { $rsrc->unique_constraints };
'correct unique constraint in schema2');
lives_and {
- ok $test_schema->source($monikers{'2.6'})
+ ok $test_schema->source('OracleLoaderTest6')
->has_relationship('oracle_loader_test4');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source($monikers{'1.4'})
+ ok $test_schema->source('OracleLoaderTest4')
->has_relationship('oracle_loader_test6s');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source($monikers{'1.8'})
+ ok $test_schema->source('OracleLoaderTest8')
->has_relationship('oracle_loader_test7');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source($monikers{'2.7'})
+ ok $test_schema->source('OracleLoaderTest7')
->has_relationship('oracle_loader_test8s');
} 'cross-schema relationship in multi-db_schema';
}
my $user = $ENV{DBICTEST_SYBASE_USER} || '';
my $password = $ENV{DBICTEST_SYBASE_PASS} || '';
+BEGIN { $ENV{DBIC_SYBASE_FREETDS_NOWARN} = 1 }
+
my ($schema, $databases_created); # for cleanup in END for extra tests
my $tester = dbixcsl_common_tests->new(
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/database name/],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
} 'connected test schema';
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest1SybaseLoaderTest4');
+ ok $rsrc = $test_schema->source('SybaseLoaderTest4');
} 'got source for table in database one';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database one';
lives_and {
- ok $rs = $test_schema->resultset('DbicslTest1SybaseLoaderTest4');
+ ok $rs = $test_schema->resultset('SybaseLoaderTest4');
} 'got resultset for table in database one';
lives_and {
'correct unique constraint in database one');
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest2SybaseLoaderTest6');
+ ok $rsrc = $test_schema->source('SybaseLoaderTest6');
} 'got source for table in database two';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database two introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset('DbicslTest2SybaseLoaderTest6');
+ ok $rs = $test_schema->resultset('SybaseLoaderTest6');
} 'got resultset for table in database two';
lives_and {
'relationship in database two';
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest2SybaseLoaderTest7');
+ ok $rsrc = $test_schema->source('SybaseLoaderTest7');
} 'got source for table in database two';
%uniqs = try { $rsrc->unique_constraints };
'correct unique constraint in database two');
lives_and {
- ok $test_schema->source('DbicslTest2SybaseLoaderTest6')
+ ok $test_schema->source('SybaseLoaderTest6')
->has_relationship('sybase_loader_test4');
} 'cross-database relationship in multi database schema';
lives_and {
- ok $test_schema->source('DbicslTest1SybaseLoaderTest4')
+ ok $test_schema->source('SybaseLoaderTest4')
->has_relationship('sybase_loader_test6s');
} 'cross-database relationship in multi database schema';
lives_and {
- ok $test_schema->source('DbicslTest1SybaseLoaderTest8')
+ ok $test_schema->source('SybaseLoaderTest8')
->has_relationship('sybase_loader_test7');
} 'cross-database relationship in multi database schema';
lives_and {
- ok $test_schema->source('DbicslTest2SybaseLoaderTest7')
+ ok $test_schema->source('SybaseLoaderTest7')
->has_relationship('sybase_loader_test8s');
} 'cross-database relationship in multi database schema';
}
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/schema name/],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
} 'connected test schema';
lives_and {
- ok $rsrc = $test_schema->source('DbicslDashTestMssqlLoaderTest8');
+ ok $rsrc = $test_schema->source('MssqlLoaderTest8');
} 'got source for table in schema name with dash';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema name with dash';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDashTestMssqlLoaderTest8');
+ ok $rs = $test_schema->resultset('MssqlLoaderTest8');
} 'got resultset for table in schema name with dash';
lives_and {
'correct unique constraint in schema name with dash');
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestMssqlLoaderTest10');
+ ok $rsrc = $test_schema->source('MssqlLoaderTest10');
} 'got source for table in schema name with dot';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema name with dot introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset('DbicslDotTestMssqlLoaderTest10');
+ ok $rs = $test_schema->resultset('MssqlLoaderTest10');
} 'got resultset for table in schema name with dot';
lives_and {
'relationship in schema name with dot';
lives_and {
- ok $rsrc = $test_schema->source('DbicslDotTestMssqlLoaderTest11');
+ ok $rsrc = $test_schema->source('MssqlLoaderTest11');
} 'got source for table in schema name with dot';
%uniqs = try { $rsrc->unique_constraints };
'correct unique constraint in schema name with dot');
lives_and {
- ok $test_schema->source('DbicslDotTestMssqlLoaderTest10')
+ ok $test_schema->source('MssqlLoaderTest10')
->has_relationship('mssql_loader_test8');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestMssqlLoaderTest8')
+ ok $test_schema->source('MssqlLoaderTest8')
->has_relationship('mssql_loader_test10s');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDashTestMssqlLoaderTest12')
+ ok $test_schema->source('MssqlLoaderTest12')
->has_relationship('mssql_loader_test11');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslDotTestMssqlLoaderTest11')
+ ok $test_schema->source('MssqlLoaderTest11')
->has_relationship('mssql_loader_test12s');
} 'cross-schema relationship in multi-db_schema';
}
$dbh->do('CREATE DATABASE dbicsl_test1');
}
catch {
+ diag "no CREATE DATABASE privileges: '$_'";
skip "no CREATE DATABASE privileges", 26 * 2;
};
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/database name/],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
my ($rsrc, $rs, $row, $rel_info, %uniqs);
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest1MssqlLoaderTest13');
+ ok $rsrc = $test_schema->source('MssqlLoaderTest13');
} 'got source for table in database one';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database one';
lives_and {
- ok $rs = $test_schema->resultset('DbicslTest1MssqlLoaderTest13');
+ ok $rs = $test_schema->resultset('MssqlLoaderTest13');
} 'got resultset for table in database one';
lives_and {
'correct unique constraint in database one');
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest2MssqlLoaderTest15');
+ ok $rsrc = $test_schema->source('MssqlLoaderTest15');
} 'got source for table in database two';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database two introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset('DbicslTest2MssqlLoaderTest15');
+ ok $rs = $test_schema->resultset('MssqlLoaderTest15');
} 'got resultset for table in database two';
lives_and {
'relationship in database two';
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest2MssqlLoaderTest16');
+ ok $rsrc = $test_schema->source('MssqlLoaderTest16');
} 'got source for table in database two';
%uniqs = try { $rsrc->unique_constraints };
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/schema name/],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
} 'connected test schema';
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest1SqlanywhereLoaderTest4');
+ ok $rsrc = $test_schema->source('SqlanywhereLoaderTest4');
} 'got source for table in schema one';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema one';
lives_and {
- ok $rs = $test_schema->resultset('DbicslTest1SqlanywhereLoaderTest4');
+ ok $rs = $test_schema->resultset('SqlanywhereLoaderTest4');
} 'got resultset for table in schema one';
lives_and {
'correct unique constraint in schema one');
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest2SqlanywhereLoaderTest6');
+ ok $rsrc = $test_schema->source('SqlanywhereLoaderTest6');
} 'got source for table in schema two';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in schema two introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset('DbicslTest2SqlanywhereLoaderTest6');
+ ok $rs = $test_schema->resultset('SqlanywhereLoaderTest6');
} 'got resultset for table in schema two';
lives_and {
'relationship in schema two';
lives_and {
- ok $rsrc = $test_schema->source('DbicslTest2SqlanywhereLoaderTest7');
+ ok $rsrc = $test_schema->source('SqlanywhereLoaderTest7');
} 'got source for table in schema two';
%uniqs = try { $rsrc->unique_constraints };
'correct unique constraint in schema two');
lives_and {
- ok $test_schema->source('DbicslTest2SqlanywhereLoaderTest6')
+ ok $test_schema->source('SqlanywhereLoaderTest6')
->has_relationship('sqlanywhere_loader_test4');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslTest1SqlanywhereLoaderTest4')
+ ok $test_schema->source('SqlanywhereLoaderTest4')
->has_relationship('sqlanywhere_loader_test6s');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslTest1SqlanywhereLoaderTest8')
+ ok $test_schema->source('SqlanywhereLoaderTest8')
->has_relationship('sqlanywhere_loader_test7');
} 'cross-schema relationship in multi-db_schema';
lives_and {
- ok $test_schema->source('DbicslTest2SqlanywhereLoaderTest7')
+ ok $test_schema->source('SqlanywhereLoaderTest7')
->has_relationship('sqlanywhere_loader_test8s');
} 'cross-schema relationship in multi-db_schema';
}
{
naming => 'current',
db_schema => $db_schema,
- moniker_parts => [qw/database name/],
dump_directory => EXTRA_DUMP_DIR,
quiet => 1,
},
my ($rsrc, $rs, $row, $rel_info, %uniqs);
lives_and {
- ok $rsrc = $test_schema->source("${db1_moniker}InformixLoaderTest4");
+ ok $rsrc = $test_schema->source("InformixLoaderTest4");
} 'got source for table in database one';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database one';
lives_and {
- ok $rs = $test_schema->resultset("${db1_moniker}InformixLoaderTest4");
+ ok $rs = $test_schema->resultset("InformixLoaderTest4");
} 'got resultset for table in database one';
lives_and {
'correct unique constraint in database one');
lives_and {
- ok $rsrc = $test_schema->source("${db2_moniker}InformixLoaderTest6");
+ ok $rsrc = $test_schema->source("InformixLoaderTest6");
} 'got source for table in database two';
is try { $rsrc->column_info('id')->{is_auto_increment} }, 1,
'column in database two introspected correctly';
lives_and {
- ok $rs = $test_schema->resultset("${db2_moniker}InformixLoaderTest6");
+ ok $rs = $test_schema->resultset("InformixLoaderTest6");
} 'got resultset for table in database two';
lives_and {
'relationship in database two';
lives_and {
- ok $rsrc = $test_schema->source("${db2_moniker}InformixLoaderTest7");
+ ok $rsrc = $test_schema->source("InformixLoaderTest7");
} 'got source for table in database two';
%uniqs = try { $rsrc->unique_constraints };