1 package # hide from PAUSE
2 DBICTest::Schema::Artist;
4 use base 'DBIx::Class::Core';
6 __PACKAGE__->table('artist');
7 __PACKAGE__->source_info({
8 "source_info_key_A" => "source_info_value_A",
9 "source_info_key_B" => "source_info_value_B",
10 "source_info_key_C" => "source_info_value_C",
12 __PACKAGE__->add_columns(
14 data_type => 'integer',
15 is_auto_increment => 1,
18 data_type => 'varchar',
23 __PACKAGE__->set_primary_key('artistid');
25 __PACKAGE__->mk_classdata('field_name_for', {
26 artistid => 'primary key',
27 name => 'artist name',
30 __PACKAGE__->has_many(
31 cds => 'DBICTest::Schema::CD', undef,
32 { order_by => 'year' },
34 __PACKAGE__->has_many(
35 cds_unordered => 'DBICTest::Schema::CD'
38 __PACKAGE__->has_many( twokeys => 'DBICTest::Schema::TwoKeys' );
39 __PACKAGE__->has_many( onekeys => 'DBICTest::Schema::OneKey' );
41 __PACKAGE__->has_many(
42 artist_undirected_maps => 'DBICTest::Schema::ArtistUndirectedMap',
43 [ {'foreign.id1' => 'self.artistid'}, {'foreign.id2' => 'self.artistid'} ],
44 { cascade_copy => 0 } # this would *so* not make sense
47 sub sqlt_deploy_hook {
48 my ($self, $sqlt_table) = @_;
51 if ($sqlt_table->schema->translator->producer_type =~ /SQLite$/ ) {
52 $sqlt_table->add_index( name => 'artist_name', fields => ['name'] )
53 or die $sqlt_table->error;