my $schema = DBICTest->init_schema();
-plan tests => 39;
+plan tests => 43;
# Check the defined unique constraints
is_deeply(
is($cd9->title, $cd1->title, 'title is correct');
is($cd9->year, 2021, 'year is correct');
-# KNOWN TO FAIL: Table with two unique constraints, and we're satisying one of them
+# Table with two unique constraints, and we're satisying one of them
my $track = $schema->resultset('Track')->find(
{
cd => 1,
is($track->get_column('cd'), 1, 'track cd is correct');
is($track->get_column('position'), 3, 'track position is correct');
+
+# Test a table with a unique constraint but no primary key
+my $row = $schema->resultset('NoPrimaryKey')->update_or_create(
+ {
+ foo => 1,
+ bar => 2,
+ baz => 3,
+ },
+ { key => 'foo_bar' }
+);
+ok(! $row->is_changed, 'update_or_create on table without primary key: row is clean');
+is($row->foo, 1, 'foo is correct');
+is($row->bar, 2, 'bar is correct');
+is($row->baz, 3, 'baz is correct');