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