f44db21ba87b2e35c83710640e96d281cbfc59d4
[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 );
24 __PACKAGE__->set_primary_key('cdid');
25 __PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
26
27 __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { 
28     is_deferrable => 1, 
29     on_delete => undef,
30     on_update => 'SET NULL',
31 });
32
33 __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' );
34 __PACKAGE__->has_many(
35     tags => 'DBICTest::Schema::Tag', undef,
36     { order_by => 'tag' },
37 );
38 __PACKAGE__->has_many(
39     cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd'
40 );
41
42 __PACKAGE__->might_have(
43     liner_notes => 'DBICTest::Schema::LinerNotes', undef,
44     { proxy => [ qw/notes/ ] },
45 );
46 __PACKAGE__->many_to_many( producers => cd_to_producer => 'producer' );
47 __PACKAGE__->many_to_many(
48     producers_sorted => cd_to_producer => 'producer',
49     { order_by => 'producer.name' },
50 );
51
52 1;