8bb7f5d319ec4adac57d26dd4f9090fb3ebc98b1
[dbsrgits/DBIx-Class.git] / t / lib / ViewDeps / Result / CD.pm
1 package    # hide from PAUSE
2     ViewDeps::Result::CD;
3
4 use strict;
5 use warnings;
6 use base 'DBIx::Class::Core';
7
8 __PACKAGE__->table('cd');
9
10 __PACKAGE__->add_columns(
11     id            => { data_type => 'integer', is_auto_increment => 1 },
12     title         => { data_type => 'text' },
13     artist        => { data_type => 'integer', is_nullable       => 0 },
14     year          => { data_type => 'integer' },
15     number_tracks => { data_type => 'integer' },
16 );
17
18 __PACKAGE__->set_primary_key('id');
19
20 __PACKAGE__->refers_to( 'artist', 'ViewDeps::Result::Artist',
21     { "foreign.id" => "self.artist" },
22 );
23
24 __PACKAGE__->has_many( 'tracks', 'ViewDeps::Result::Track',
25     { "foreign.cd" => "self.id" },
26 );
27
28 1;