Commit | Line | Data |
0567538f |
1 | package DBICTest::Schema::BasicRels; |
2 | |
3 | use base 'DBIx::Class::Core'; |
4 | |
5 | DBICTest::Schema::Artist->add_relationship( |
6 | cds => 'DBICTest::Schema::CD', |
7 | { 'foreign.artist' => 'self.artistid' }, |
54540863 |
8 | { order_by => 'year', join_type => 'LEFT', cascade_delete => 1 } |
0567538f |
9 | ); |
10 | DBICTest::Schema::Artist->add_relationship( |
11 | twokeys => 'DBICTest::Schema::TwoKeys', |
12 | { 'foreign.artist' => 'self.artistid' } |
13 | ); |
14 | DBICTest::Schema::Artist->add_relationship( |
15 | onekeys => 'DBICTest::Schema::OneKey', |
16 | { 'foreign.artist' => 'self.artistid' } |
17 | ); |
18 | |
19 | DBICTest::Schema::CD->add_relationship( |
20 | artist => 'DBICTest::Schema::Artist', |
21 | { 'foreign.artistid' => 'self.artist' }, |
8452e496 |
22 | { accessor => 'filter' }, |
0567538f |
23 | ); |
24 | DBICTest::Schema::CD->add_relationship( |
25 | tracks => 'DBICTest::Schema::Track', |
54540863 |
26 | { 'foreign.cd' => 'self.cdid' }, |
27 | { join_type => 'LEFT', cascade_delete => 1 } |
0567538f |
28 | ); |
29 | DBICTest::Schema::CD->add_relationship( |
30 | tags => 'DBICTest::Schema::Tag', |
54540863 |
31 | { 'foreign.cd' => 'self.cdid' }, |
32 | { join_type => 'LEFT', cascade_delete => 1 } |
0567538f |
33 | ); |
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' }, |
8452e496 |
38 | { join_type => 'LEFT', accessor => 'single' } |
0567538f |
39 | ); |
7411204b |
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 } |
44 | ); |
0567538f |
45 | |
46 | DBICTest::Schema::SelfRefAlias->add_relationship( |
47 | self_ref => 'DBICTest::Schema::SelfRef', |
48 | { 'foreign.id' => 'self.self_ref' }, |
49 | { accessor => 'single' } |
50 | |
51 | ); |
52 | DBICTest::Schema::SelfRefAlias->add_relationship( |
53 | alias => 'DBICTest::Schema::SelfRef', |
54 | { 'foreign.id' => 'self.alias' }, |
55 | { accessor => 'single' } |
56 | ); |
57 | |
58 | DBICTest::Schema::SelfRef->add_relationship( |
59 | aliases => 'DBICTest::Schema::SelfRefAlias', |
60 | { 'foreign.self_ref' => 'self.id' }, |
61 | { accessor => 'multi' } |
62 | ); |
63 | |
64 | DBICTest::Schema::Tag->add_relationship( |
65 | cd => 'DBICTest::Schema::CD', |
66 | { 'foreign.cdid' => 'self.cd' } |
67 | ); |
68 | |
69 | DBICTest::Schema::Track->add_relationship( |
70 | cd => 'DBICTest::Schema::CD', |
71 | { 'foreign.cdid' => 'self.cd' } |
72 | ); |
73 | |
74 | DBICTest::Schema::TwoKeys->add_relationship( |
75 | artist => 'DBICTest::Schema::Artist', |
76 | { 'foreign.artistid' => 'self.artist' } |
77 | ); |
78 | DBICTest::Schema::TwoKeys->add_relationship( |
79 | cd => 'DBICTest::Schema::CD', |
80 | { 'foreign.cdid' => 'self.cd' } |
81 | ); |
82 | |
7411204b |
83 | DBICTest::Schema::CD_to_Producer->add_relationship( |
84 | cd => 'DBICTest::Schema::CD', |
85 | { 'foreign.cdid' => 'self.cd' } |
86 | ); |
87 | DBICTest::Schema::CD_to_Producer->add_relationship( |
88 | producer => 'DBICTest::Schema::Producer', |
89 | { 'foreign.producerid' => 'self.producer' } |
90 | ); |
91 | |
92 | # now the Helpers |
93 | DBICTest::Schema::CD->many_to_many( 'producers', 'cd_to_producer', 'producer'); |
94 | |
0567538f |
95 | 1; |