Commit | Line | Data |
a5bd5d88 |
1 | package MyApp::Schema::Result::Cd; |
d88ecca6 |
2 | |
3 | use warnings; |
4 | use strict; |
5 | |
20bfea3f |
6 | use 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 | }, |
1f9ae1a3 |
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 | |
1f9ae1a3 |
29 | __PACKAGE__->add_unique_constraint([qw( title artistid )]); |
20bfea3f |
30 | |
1f9ae1a3 |
31 | __PACKAGE__->belongs_to('artist' => 'MyApp::Schema::Result::Artist', 'artistid'); |
32 | __PACKAGE__->has_many('tracks' => 'MyApp::Schema::Result::Track', 'cdid'); |
0c337847 |
33 | |
34 | 1; |