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