doh2
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / CD.pm
1 package # hide from PAUSE 
2     DBICTest::Schema::CD;
3
4 use base 'DBIx::Class::Core';
5
6 __PACKAGE__->table('cd');
7 __PACKAGE__->add_columns(
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',
17     size      => 100,
18   },
19   'year' => {
20     data_type => 'varchar',
21     size      => 100,
22   },
23   'genreid' => { 
24     data_type => 'integer',
25     is_nullable => 1,
26   }
27 );
28 __PACKAGE__->set_primary_key('cdid');
29 __PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
30
31 __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { 
32     is_deferrable => 1, 
33     on_delete => undef,
34     on_update => 'SET NULL',
35 });
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 );
55
56 __PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', { 'foreign.genreid' => 'self.genreid' });
57
58 #__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre',
59 #    { 'foreign.genreid' => 'self.genreid' },
60 #    { 'accessor' => 'single' }
61 #);
62
63 1;