349addbe81158c168ce840005f0103f20b180398
[dbsrgits/DBIx-Class.git] / t / lib / ViewDepsBad / Result / Year2010CDsWithManyTracks.pm
1 package    # hide from PAUSE
2     ViewDepsBad::Result::Year2010CDsWithManyTracks;
3
4 use strict;
5 use warnings;
6 use base 'ViewDepsBad::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(
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"
12 );
13
14 __PACKAGE__->result_source_instance->deploy_depends_on(
15     ["Year2010CDs"] );
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' },
23     file       => { data_type => 'integer' },
24 );
25
26 __PACKAGE__->set_primary_key('id');
27
28 __PACKAGE__->belongs_to( 'artist', 'ViewDepsBad::Result::Artist',
29     { "foreign.id" => "self.artist" },
30 );
31
32 __PACKAGE__->has_many( 'tracks', 'ViewDepsBad::Result::Track',
33     { "foreign.cd" => "self.id" },
34 );
35
36 1;