fix related resultsets and multi-create
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / CD.pm
CommitLineData
c6d74d3e 1package # hide from PAUSE
2 DBICTest::Schema::CD;
a02675cd 3
4use 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' => {
24 data_type => 'integer'
25 }
0009fa49 26);
ff657a43 27__PACKAGE__->set_primary_key('cdid');
368a5228 28__PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
ff657a43 29
e377d723 30__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, {
31 is_deferrable => 1,
32 on_delete => undef,
33 on_update => 'SET NULL',
34});
ff657a43 35
36__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' );
37__PACKAGE__->has_many(
38 tags => 'DBICTest::Schema::Tag', undef,
39 { order_by => 'tag' },
40);
41__PACKAGE__->has_many(
42 cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd'
43);
44
45__PACKAGE__->might_have(
46 liner_notes => 'DBICTest::Schema::LinerNotes', undef,
47 { proxy => [ qw/notes/ ] },
48);
49__PACKAGE__->many_to_many( producers => cd_to_producer => 'producer' );
50__PACKAGE__->many_to_many(
51 producers_sorted => cd_to_producer => 'producer',
52 { order_by => 'producer.name' },
53);
a02675cd 54
370f2ba2 55__PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', { 'foreign.genreid' => 'self.genreid' });
56
57#__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre',
58# { 'foreign.genreid' => 'self.genreid' },
59# { 'accessor' => 'single' }
60#);
61
a02675cd 621;