Update example Result classes for proper DDL generation
[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 },
15 artist => {
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
20bfea3f 29__PACKAGE__->add_unique_constraint([qw( title artist )]);
30
a5bd5d88 31__PACKAGE__->belongs_to('artist' => 'MyApp::Schema::Result::Artist');
32__PACKAGE__->has_many('tracks' => 'MyApp::Schema::Result::Track');
0c337847 33
341;