Fix two aliasing bugs: remove the alias when provided to new_result and add the alias...
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / Artist.pm
1 package # hide from PAUSE 
2     DBICTest::Schema::Artist;
3
4 use base 'DBIx::Class::Core';
5
6 __PACKAGE__->table('artist');
7 __PACKAGE__->add_columns(
8   'artistid' => {
9     data_type => 'integer',
10     is_auto_increment => 1
11   },
12   'agent' => {
13     data_type   => 'integer',
14     is_nullable => 1,
15   },
16   'name' => {
17     data_type => 'varchar',
18     size      => 100,
19     is_nullable => 1,
20   },
21 );
22 __PACKAGE__->set_primary_key('artistid');
23
24 __PACKAGE__->mk_classdata('field_name_for', {
25     artistid    => 'primary key',
26     agent       => 'agent',
27     name        => 'artist name',
28 });
29
30 __PACKAGE__->has_many(
31     cds => 'DBICTest::Schema::CD', undef,
32     { order_by => 'year' },
33 );
34
35 __PACKAGE__->belongs_to( agent => 'DBICTest::Schema::Agent' );
36
37 __PACKAGE__->has_many( twokeys => 'DBICTest::Schema::TwoKeys' );
38 __PACKAGE__->has_many( onekeys => 'DBICTest::Schema::OneKey' );
39
40 __PACKAGE__->has_many(
41   artist_undirected_maps => 'DBICTest::Schema::ArtistUndirectedMap',
42   [ {'foreign.id1' => 'self.artistid'}, {'foreign.id2' => 'self.artistid'} ],
43   { cascade_copy => 0 } # this would *so* not make sense
44 );
45
46 1;