Commit | Line | Data |
a1e6f9a5 |
1 | package # hide from PAUSE |
2 | DBICTest::Schema::Year1999CDs; |
3 | ## Used in 104view.t |
4 | |
660cf1be |
5 | use base qw/DBICTest::BaseResult/; |
a1e6f9a5 |
6 | |
7 | __PACKAGE__->table_class('DBIx::Class::ResultSource::View'); |
8 | |
9 | __PACKAGE__->table('year1999cds'); |
10 | __PACKAGE__->result_source_instance->is_virtual(1); |
11 | __PACKAGE__->result_source_instance->view_definition( |
f549392f |
12 | "SELECT cdid, artist, title, single_track FROM cd WHERE year ='1999'" |
a1e6f9a5 |
13 | ); |
14 | __PACKAGE__->add_columns( |
15 | 'cdid' => { |
16 | data_type => 'integer', |
17 | is_auto_increment => 1, |
18 | }, |
19 | 'artist' => { |
20 | data_type => 'integer', |
21 | }, |
22 | 'title' => { |
23 | data_type => 'varchar', |
24 | size => 100, |
25 | }, |
f549392f |
26 | 'single_track' => { |
27 | data_type => 'integer', |
28 | is_nullable => 1, |
29 | is_foreign_key => 1, |
30 | }, |
a1e6f9a5 |
31 | ); |
32 | __PACKAGE__->set_primary_key('cdid'); |
33 | __PACKAGE__->add_unique_constraint([ qw/artist title/ ]); |
34 | |
59d89269 |
35 | __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' ); |
18129e81 |
36 | __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track', |
37 | { "foreign.cd" => "self.cdid" }); |
59d89269 |
38 | |
a1e6f9a5 |
39 | 1; |