]> Dogcows Code - chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate/blob - t/lib/DBICTest/Schema/ForceForeign.pm
test case for might_have and another minor bug fix
[chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate] / t / lib / DBICTest / Schema / ForceForeign.pm
1 package # hide from PAUSE
2 DBICTest::Schema::ForceForeign;
3
4 use base 'DBIx::Class::Core';
5
6 __PACKAGE__->table('forceforeign');
7 __PACKAGE__->add_columns(
8 'artist' => { data_type => 'integer' },
9 'cd' => { data_type => 'integer' },
10 );
11 __PACKAGE__->set_primary_key(qw/artist/);
12
13 # Normally this would not appear as a FK constraint
14 # since it uses the PK
15 __PACKAGE__->might_have(
16 'artist_1', 'DBICTest::Schema::Artist', {
17 'foreign.artistid' => 'self.artist',
18 }, {
19 is_foreign_key_constraint => 1,
20 },
21 );
22
23 # Normally this would appear as a FK constraint
24 __PACKAGE__->might_have(
25 'cd_1', 'DBICTest::Schema::CD', {
26 'foreign.cdid' => 'self.cd',
27 }, {
28 is_foreign_key_constraint => 0,
29 },
30 );
31
32 # Normally this would appear as a FK constraint
33 __PACKAGE__->belongs_to(
34 'cd_3', 'DBICTest::Schema::CD', {
35 'foreign.cdid' => 'self.cd',
36 }, {
37 is_foreign_key_constraint => 0,
38 },
39 );
40
41 1;
This page took 0.032516 seconds and 4 git commands to generate.