1 package # hide from PAUSE
2 DBICTest::Schema::CDTableRef;
4 use base qw/DBICTest::BaseResult/;
6 __PACKAGE__->table(\'cd');
8 __PACKAGE__->add_columns(
10 data_type => 'integer',
11 is_auto_increment => 1,
14 data_type => 'integer',
17 data_type => 'varchar',
21 data_type => 'varchar',
25 data_type => 'integer',
29 data_type => 'integer',
34 __PACKAGE__->set_primary_key('cdid');
35 __PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
37 __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist',
42 # in case this is a single-cd it promotes a track from another cd
43 __PACKAGE__->belongs_to( single_track => 'DBICTest::Schema::Track', 'single_track',
44 { join_type => 'left'}
47 __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track', 'cd' );
48 __PACKAGE__->has_many(
49 tags => 'DBICTest::Schema::Tag', 'cd',
50 { order_by => 'tag' },
52 __PACKAGE__->has_many(
53 cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd'
56 __PACKAGE__->might_have(
57 liner_notes => 'DBICTest::Schema::LinerNotes', undef,
58 { proxy => [ qw/notes/ ] },
60 __PACKAGE__->might_have(artwork => 'DBICTest::Schema::Artwork', 'cd_id');
62 __PACKAGE__->many_to_many( producers => cd_to_producer => 'producer' );
63 __PACKAGE__->many_to_many(
64 producers_sorted => cd_to_producer => 'producer',
65 { order_by => 'producer.name' },
68 __PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre',
69 { 'foreign.genreid' => 'self.genreid' },
72 on_delete => 'SET NULL',
73 on_update => 'CASCADE',
77 #This second relationship was added to test the short-circuiting of pointless
78 #queries provided by undef_on_null_fk. the relevant test in 66relationship.t
79 __PACKAGE__->belongs_to('genre_inefficient', 'DBICTest::Schema::Genre',
80 { 'foreign.genreid' => 'self.genreid' },
83 on_delete => 'SET NULL',
84 on_update => 'CASCADE',
85 undef_on_null_fk => 0,