# datalink => { data_type => 'datalink' },
},
extra => {
- count => 28 * 2,
+ count => 30 * 2,
run => sub {
SKIP: {
$schema = shift;
CREATE TABLE "dbicsl-test".db2_loader_test5 (
id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY,
value VARCHAR(100),
- four_id INTEGER NOT NULL UNIQUE,
+ four_id INTEGER NOT NULL,
+ CONSTRAINT loader_test5_uniq UNIQUE (four_id),
FOREIGN KEY (four_id) REFERENCES "dbicsl-test".db2_loader_test4 (id)
)
EOF
$dbh->do('CREATE SCHEMA "dbicsl.test"');
$dbh->do(<<"EOF");
+ CREATE TABLE "dbicsl.test".db2_loader_test5 (
+ pk INT GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY,
+ value VARCHAR(100),
+ four_id INTEGER NOT NULL,
+ CONSTRAINT loader_test5_uniq UNIQUE (four_id),
+ FOREIGN KEY (four_id) REFERENCES "dbicsl-test".db2_loader_test4 (id)
+ )
+EOF
+ $dbh->do(<<"EOF");
CREATE TABLE "dbicsl.test".db2_loader_test6 (
id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY,
value VARCHAR(100),
ok $row = $rs->create({ value => 'foo' });
} 'executed SQL on table in schema name with dash';
- $rel_info = try { $rsrc->relationship_info('db2_loader_test5') };
+ $rel_info = try { $rsrc->relationship_info('dbicsl_dash_test_db2_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('Db2LoaderTest5');
+ ok $rsrc = $test_schema->source('DbicslDashTestDb2LoaderTest5');
} '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'],
+ 'correct unique constraint in schema name with dash');
+
lives_and {
ok $rsrc = $test_schema->source('Db2LoaderTest6');
} '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'],
+ 'correct unique constraint in schema name with dot');
+
lives_and {
ok $test_schema->source('Db2LoaderTest6')
->has_relationship('db2_loader_test4');
'"dbicsl.test".db2_loader_test7',
'"dbicsl.test".db2_loader_test6',
'"dbicsl-test".db2_loader_test5',
+ '"dbicsl.test".db2_loader_test5',
'"dbicsl-test".db2_loader_test4') {
try {
$dbh->do("DROP TABLE $table");