Commit | Line | Data |
c6d74d3e |
1 | package # hide from PAUSE |
2 | DBICTest::Schema::CD; |
a02675cd |
3 | |
4 | use base 'DBIx::Class::Core'; |
5 | |
ff657a43 |
6 | __PACKAGE__->table('cd'); |
7 | __PACKAGE__->add_columns( |
0009fa49 |
8 | 'cdid' => { |
9 | data_type => 'integer', |
10 | is_auto_increment => 1, |
11 | }, |
12 | 'artist' => { |
13 | data_type => 'integer', |
14 | }, |
15 | 'title' => { |
16 | data_type => 'varchar', |
cb561d1a |
17 | size => 100, |
0009fa49 |
18 | }, |
19 | 'year' => { |
20 | data_type => 'varchar', |
cb561d1a |
21 | size => 100, |
0009fa49 |
22 | }, |
370f2ba2 |
23 | 'genreid' => { |
4e0eaf64 |
24 | data_type => 'integer', |
25 | is_nullable => 1, |
370f2ba2 |
26 | } |
0009fa49 |
27 | ); |
ff657a43 |
28 | __PACKAGE__->set_primary_key('cdid'); |
368a5228 |
29 | __PACKAGE__->add_unique_constraint([ qw/artist title/ ]); |
ff657a43 |
30 | |
e377d723 |
31 | __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { |
32 | is_deferrable => 1, |
33 | on_delete => undef, |
34 | on_update => 'SET NULL', |
35 | }); |
ff657a43 |
36 | |
37 | __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' ); |
38 | __PACKAGE__->has_many( |
39 | tags => 'DBICTest::Schema::Tag', undef, |
40 | { order_by => 'tag' }, |
41 | ); |
42 | __PACKAGE__->has_many( |
43 | cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd' |
44 | ); |
45 | |
46 | __PACKAGE__->might_have( |
47 | liner_notes => 'DBICTest::Schema::LinerNotes', undef, |
48 | { proxy => [ qw/notes/ ] }, |
49 | ); |
50 | __PACKAGE__->many_to_many( producers => cd_to_producer => 'producer' ); |
51 | __PACKAGE__->many_to_many( |
52 | producers_sorted => cd_to_producer => 'producer', |
53 | { order_by => 'producer.name' }, |
54 | ); |
a02675cd |
55 | |
87310237 |
56 | __PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', |
57 | { 'foreign.genreid' => 'self.genreid' }, |
58 | { join_type => 'left' }, |
59 | ); |
370f2ba2 |
60 | |
61 | #__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre', |
62 | # { 'foreign.genreid' => 'self.genreid' }, |
63 | # { 'accessor' => 'single' } |
64 | #); |
65 | |
a02675cd |
66 | 1; |