Documentation improvements cherry-picked from latest
[dbsrgits/DBIx-Class.git] / examples / Schema / MyApp / Schema / Result / Cd.pm
1 package MyApp::Schema::Result::Cd;
2
3 use warnings;
4 use strict;
5
6 use base qw( DBIx::Class::Core );
7
8 __PACKAGE__->table('cd');
9
10 __PACKAGE__->add_columns(
11   cdid => {
12     data_type => 'integer',
13     is_auto_increment => 1
14   },
15   artistid => {
16     data_type => 'integer',
17   },
18   title => {
19     data_type => 'text',
20   },
21   year => {
22     data_type => 'datetime',
23     is_nullable => 1,
24   },
25 );
26
27 __PACKAGE__->set_primary_key('cdid');
28
29 __PACKAGE__->add_unique_constraint([qw( title artistid )]);
30
31 __PACKAGE__->belongs_to('artist' => 'MyApp::Schema::Result::Artist', 'artistid');
32 __PACKAGE__->has_many('tracks' => 'MyApp::Schema::Result::Track', 'cdid');
33
34 1;