CREATE TABLE "dbicsl-test".pg_loader_test5 (
id SERIAL PRIMARY KEY,
value VARCHAR(100),
- four_id INTEGER UNIQUE REFERENCES "dbicsl-test".pg_loader_test4 (id)
+ four_id INTEGER REFERENCES "dbicsl-test".pg_loader_test4 (id),
+ CONSTRAINT loader_test5_uniq UNIQUE (four_id)
)
},
q{
CREATE SCHEMA "dbicsl.test"
},
q{
+ CREATE TABLE "dbicsl.test".pg_loader_test5 (
+ pk SERIAL PRIMARY KEY,
+ value VARCHAR(100),
+ four_id INTEGER REFERENCES "dbicsl-test".pg_loader_test4 (id),
+ CONSTRAINT loader_test5_uniq UNIQUE (four_id)
+ )
+ },
+ q{
CREATE TABLE "dbicsl.test".pg_loader_test6 (
id SERIAL PRIMARY KEY,
value VARCHAR(100),
'DROP TYPE pg_loader_test_enum',
],
drop => [ qw/ pg_loader_test1 pg_loader_test2 / ],
- count => 4 + 28 * 2,
+ count => 4 + 30 * 2,
run => sub {
my ($schema, $monikers, $classes) = @_;
ok $row = $rs->create({ value => 'foo' });
} 'executed SQL on table in schema name with dash';
- $rel_info = try { $rsrc->relationship_info('pg_loader_test5') };
+ $rel_info = try { $rsrc->relationship_info('dbicsl_dash_test_pg_loader_test5') };
is_deeply $rel_info->{cond}, {
'foreign.four_id' => 'self.id'
'relationship in schema name with dash';
lives_and {
- ok $rsrc = $test_schema->source('PgLoaderTest5');
+ ok $rsrc = $test_schema->source('DbicslDashTestPgLoaderTest5');
} 'got source for table in schema name with dash';
%uniqs = try { $rsrc->unique_constraints };
is keys %uniqs, 2,
'got unique and primary constraint in schema name with dash';
+ delete $uniqs{primary};
+
+ is_deeply ((values %uniqs)[0], ['four_id'],
+ 'unique constraint is correct in schema name with dash');
+
lives_and {
ok $rsrc = $test_schema->source('PgLoaderTest6');
} 'got source for table in schema name with dot';
is keys %uniqs, 2,
'got unique and primary constraint in schema name with dot';
+ delete $uniqs{primary};
+
+ is_deeply ((values %uniqs)[0], ['six_id'],
+ 'unique constraint is correct in schema name with dot');
+
lives_and {
ok $test_schema->source('PgLoaderTest6')
->has_relationship('pg_loader_test4');