9 my $schema = DBICTest->init_schema();
12 $schema->storage->debugcb( sub{ $queries++ } );
13 my $sdebug = $schema->storage->debug;
15 my $cd = $schema->resultset("CD")->find(1);
20 $schema->storage->debug(1);
24 is($queries, 1, 'liner_notes (might_have) not prefetched - do not load
25 liner_notes on update');
27 $schema->storage->debug($sdebug);
30 my $cd2 = $schema->resultset("CD")->find(2, {prefetch => 'liner_notes'});
35 $schema->storage->debug(1);
39 is($queries, 1, 'liner_notes (might_have) prefetched - do not load
40 liner_notes on update');
43 local $ENV{DBIC_DONT_VALIDATE_RELS};
45 DBICTest::Schema::Bookmark->might_have(
46 linky => 'DBICTest::Schema::Link',
47 { "foreign.id" => "self.link" },
50 qr{"might_have/has_one" must not be on columns with is_nullable set to true},
51 'might_have should warn if the self.id column is nullable';
54 local $ENV{DBIC_DONT_VALIDATE_RELS} = 1;
56 DBICTest::Schema::Bookmark->might_have(
57 slinky => 'DBICTest::Schema::Link',
58 { "foreign.id" => "self.link" },
62 'Setting DBIC_DONT_VALIDATE_RELS suppresses nullable relation warnings';
65 $schema->storage->debug($sdebug);