1 package # hide from PAUSE
4 use base qw/DBICTest::BaseResult/;
6 # this tests table name as scalar ref
8 __PACKAGE__->table(\'cd');
10 __PACKAGE__->add_columns(
12 data_type => 'integer',
13 is_auto_increment => 1,
16 data_type => 'integer',
19 data_type => 'varchar',
23 data_type => 'varchar',
27 data_type => 'integer',
32 data_type => 'integer',
37 __PACKAGE__->set_primary_key('cdid');
38 __PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
40 __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, {
43 __PACKAGE__->belongs_to( very_long_artist_relationship => 'DBICTest::Schema::Artist', 'artist', {
47 # in case this is a single-cd it promotes a track from another cd
48 __PACKAGE__->belongs_to( single_track => 'DBICTest::Schema::Track', 'single_track',
49 { join_type => 'left'}
52 __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' );
53 __PACKAGE__->has_many(
54 tags => 'DBICTest::Schema::Tag', undef,
55 { order_by => 'tag' },
57 __PACKAGE__->has_many(
58 cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd'
61 __PACKAGE__->might_have(
62 liner_notes => 'DBICTest::Schema::LinerNotes', undef,
63 { proxy => [ qw/notes/ ] },
65 __PACKAGE__->might_have(artwork => 'DBICTest::Schema::Artwork', 'cd_id');
66 __PACKAGE__->has_one(mandatory_artwork => 'DBICTest::Schema::Artwork', 'cd_id');
68 __PACKAGE__->many_to_many( producers => cd_to_producer => 'producer' );
69 __PACKAGE__->many_to_many(
70 producers_sorted => cd_to_producer => 'producer',
71 { order_by => 'producer.name' },
74 __PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre',
75 { 'foreign.genreid' => 'self.genreid' },
78 on_delete => 'SET NULL',
79 on_update => 'CASCADE',
83 #This second relationship was added to test the short-circuiting of pointless
84 #queries provided by undef_on_null_fk. the relevant test in 66relationship.t
85 __PACKAGE__->belongs_to('genre_inefficient', 'DBICTest::Schema::Genre',
86 { 'foreign.genreid' => 'self.genreid' },
89 on_delete => 'SET NULL',
90 on_update => 'CASCADE',
91 undef_on_null_fk => 0,