Commit | Line | Data |
7364d776 |
1 | package # hide from PAUSE |
2 | ViewDeps::Result::Year2010CDsWithManyTracks; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | use base 'ViewDeps::Result::Year2010CDs'; |
7 | |
8 | __PACKAGE__->table_class('DBIx::Class::ResultSource::View'); |
9 | __PACKAGE__->table('year_2010_cds_with_many_tracks'); |
10 | __PACKAGE__->result_source_instance->view_definition( |
339f7f5d |
11 | "SELECT cd.id,cd.title,cd.artist,cd.year,cd.number_tracks,art.file FROM year_2010_cds cd JOIN artwork art on art.cd = cd.id WHERE cd.number_tracks > 10" |
7364d776 |
12 | ); |
13 | |
14 | __PACKAGE__->result_source_instance->deploy_depends_on( |
0edbc8f0 |
15 | ["ViewDeps::Result::Year2010CDs"] ); |
7364d776 |
16 | |
17 | __PACKAGE__->add_columns( |
18 | id => { data_type => 'integer', is_auto_increment => 1 }, |
19 | title => { data_type => 'text' }, |
20 | artist => { data_type => 'integer', is_nullable => 0 }, |
21 | year => { data_type => 'integer' }, |
22 | number_tracks => { data_type => 'integer' }, |
339f7f5d |
23 | file => { data_type => 'integer' }, |
7364d776 |
24 | ); |
25 | |
26 | __PACKAGE__->set_primary_key('id'); |
27 | |
28 | __PACKAGE__->belongs_to( 'artist', 'ViewDeps::Result::Artist', |
29 | { "foreign.id" => "self.artist" }, |
30 | ); |
31 | |
32 | __PACKAGE__->has_many( 'tracks', 'ViewDeps::Result::Track', |
33 | { "foreign.cd" => "self.id" }, |
34 | ); |
35 | |
36 | 1; |