Parser correct; test includes failure, shorter query tests; new test schema for bad...
[dbsrgits/DBIx-Class.git] / t / lib / ViewDepsBad / Result / Year2010CDs.pm
1 package    # hide from PAUSE
2     ViewDepsBad::Result::Year2010CDs;
3
4 use strict;
5 use warnings;
6 use base 'DBIx::Class::Core';
7
8 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
9 __PACKAGE__->table('year_2010_cds');
10 __PACKAGE__->result_source_instance->view_definition(
11     "SELECT id,title,artist,year,number_tracks FROM cd WHERE year = '2010'");
12
13 __PACKAGE__->add_columns(
14     id            => { data_type => 'integer', is_auto_increment => 1 },
15     title         => { data_type => 'text' },
16     artist        => { data_type => 'integer', is_nullable       => 0 },
17     year          => { data_type => 'integer' },
18     number_tracks => { data_type => 'integer' },
19 );
20
21 __PACKAGE__->set_primary_key('id');
22
23 __PACKAGE__->belongs_to( 'artist', 'ViewDepsBad::Result::Artist',
24     { "foreign.id" => "self.artist" },
25 );
26
27 __PACKAGE__->has_many( 'tracks', 'ViewDepsBad::Result::Track',
28     { "foreign.cd" => "self.id" },
29 );
30
31 1;