1 package DBICTest::Schema::BasicRels;
3 use base 'DBIx::Class::Core';
5 DBICTest::Schema::Artist->add_relationship(
6 cds => 'DBICTest::Schema::CD',
7 { 'foreign.artist' => 'self.artistid' },
8 { order_by => 'year', join_type => 'LEFT', cascade_delete => 1 }
10 DBICTest::Schema::Artist->add_relationship(
11 twokeys => 'DBICTest::Schema::TwoKeys',
12 { 'foreign.artist' => 'self.artistid' }
14 DBICTest::Schema::Artist->add_relationship(
15 onekeys => 'DBICTest::Schema::OneKey',
16 { 'foreign.artist' => 'self.artistid' }
19 DBICTest::Schema::CD->add_relationship(
20 artist => 'DBICTest::Schema::Artist',
21 { 'foreign.artistid' => 'self.artist' },
22 { accessor => 'filter' },
24 DBICTest::Schema::CD->add_relationship(
25 tracks => 'DBICTest::Schema::Track',
26 { 'foreign.cd' => 'self.cdid' },
27 { join_type => 'LEFT', cascade_delete => 1 }
29 DBICTest::Schema::CD->add_relationship(
30 tags => 'DBICTest::Schema::Tag',
31 { 'foreign.cd' => 'self.cdid' },
32 { join_type => 'LEFT', cascade_delete => 1 }
34 #DBICTest::Schema::CD->might_have(liner_notes => 'DBICTest::Schema::LinerNotes' => qw/notes/);
35 DBICTest::Schema::CD->add_relationship(
36 liner_notes => 'DBICTest::Schema::LinerNotes',
37 { 'foreign.liner_id' => 'self.cdid' },
38 { join_type => 'LEFT', accessor => 'single' }
40 DBICTest::Schema::CD->add_relationship(
41 cd_to_producer => 'DBICTest::Schema::CD_to_Producer',
42 { 'foreign.cd' => 'self.cdid' },
43 { join_type => 'LEFT', cascade_delete => 1 }
46 DBICTest::Schema::SelfRefAlias->add_relationship(
47 self_ref => 'DBICTest::Schema::SelfRef',
48 { 'foreign.id' => 'self.self_ref' },
49 { accessor => 'single' }
52 DBICTest::Schema::SelfRefAlias->add_relationship(
53 alias => 'DBICTest::Schema::SelfRef',
54 { 'foreign.id' => 'self.alias' },
55 { accessor => 'single' }
58 DBICTest::Schema::SelfRef->add_relationship(
59 aliases => 'DBICTest::Schema::SelfRefAlias',
60 { 'foreign.self_ref' => 'self.id' },
61 { accessor => 'multi' }
64 DBICTest::Schema::Tag->add_relationship(
65 cd => 'DBICTest::Schema::CD',
66 { 'foreign.cdid' => 'self.cd' }
69 DBICTest::Schema::Track->add_relationship(
70 cd => 'DBICTest::Schema::CD',
71 { 'foreign.cdid' => 'self.cd' }
74 DBICTest::Schema::TwoKeys->add_relationship(
75 artist => 'DBICTest::Schema::Artist',
76 { 'foreign.artistid' => 'self.artist' }
78 DBICTest::Schema::TwoKeys->add_relationship(
79 cd => 'DBICTest::Schema::CD',
80 { 'foreign.cdid' => 'self.cd' }
83 DBICTest::Schema::CD_to_Producer->add_relationship(
84 cd => 'DBICTest::Schema::CD',
85 { 'foreign.cdid' => 'self.cd' }
87 DBICTest::Schema::CD_to_Producer->add_relationship(
88 producer => 'DBICTest::Schema::Producer',
89 { 'foreign.producerid' => 'self.producer' }
93 DBICTest::Schema::CD->many_to_many( 'producers', 'cd_to_producer', 'producer');