| 1 | package Test::DBIx::Class::Example::Schema::Result::Person::Artist; { | ||
| 2 | 15 | ▶ | use base 'Test::DBIx::Class::Example::Schema::Result'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 15 | __PACKAGE__->table('person_artist'); | |
| 5 | |||
| 6 | 15 | __PACKAGE__->add_columns( | |
| 7 | artist_id => { | ||
| 8 | data_type => 'varchar', | ||
| 9 | size => '36', | ||
| 10 | is_nullable => 0, | ||
| 11 | }, | ||
| 12 | created => { | ||
| 13 | data_type => 'timestamp', | ||
| 14 | set_on_create => 1, | ||
| 15 | is_nullable => 0, | ||
| 16 | }, | ||
| 17 | ); | ||
| 18 | |||
| 19 | 15 | __PACKAGE__->set_primary_key('artist_id'); | |
| 20 | |||
| 21 | 15 | __PACKAGE__->belongs_to( | |
| 22 | person => 'Test::DBIx::Class::Example::Schema::Result::Person', | ||
| 23 | { 'foreign.person_id' => 'self.artist_id'}, | ||
| 24 | ); | ||
| 25 | |||
| 26 | 15 | __PACKAGE__->has_many( | |
| 27 | cd_artists => 'Test::DBIx::Class::Example::Schema::Result::CD::Artist', | ||
| 28 | { 'foreign.fk_artist_id' => 'self.artist_id'} | ||
| 29 | ); | ||
| 30 | |||
| 31 | 15 | __PACKAGE__->many_to_many( | |
| 32 | cds => 'cd_artists', 'cd', | ||
| 33 | ); | ||
| 34 | |||
| 35 | } 1 | ||
| 36 | |||
| 37 | 15 | __END__ | |