Not sure what this part of the test is for, but it breaks custom resultsets, and...
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / Artist.pm
CommitLineData
c6d74d3e 1package # hide from PAUSE
2 DBICTest::Schema::Artist;
a02675cd 3
4use base 'DBIx::Class::Core';
5
ff657a43 6__PACKAGE__->table('artist');
a48e92d7 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",
11});
ff657a43 12__PACKAGE__->add_columns(
0009fa49 13 'artistid' => {
14 data_type => 'integer',
6e399b4f 15 is_auto_increment => 1,
0009fa49 16 },
17 'name' => {
18 data_type => 'varchar',
cb561d1a 19 size => 100,
0009fa49 20 is_nullable => 1,
21 },
39da2a2b 22 rank => {
23 data_type => 'integer',
24 default_value => 13,
25 },
a0dd8679 26 charfield => {
27 data_type => 'char',
28 size => 10,
29 is_nullable => 1,
30 },
0009fa49 31);
ff657a43 32__PACKAGE__->set_primary_key('artistid');
a02675cd 33
90e6de6c 34__PACKAGE__->mk_classdata('field_name_for', {
35 artistid => 'primary key',
36 name => 'artist name',
37});
38
ff657a43 39__PACKAGE__->has_many(
40 cds => 'DBICTest::Schema::CD', undef,
41 { order_by => 'year' },
42);
c193d1d2 43__PACKAGE__->has_many(
44 cds_unordered => 'DBICTest::Schema::CD'
45);
ff657a43 46
47__PACKAGE__->has_many( twokeys => 'DBICTest::Schema::TwoKeys' );
48__PACKAGE__->has_many( onekeys => 'DBICTest::Schema::OneKey' );
49
50__PACKAGE__->has_many(
51 artist_undirected_maps => 'DBICTest::Schema::ArtistUndirectedMap',
52 [ {'foreign.id1' => 'self.artistid'}, {'foreign.id2' => 'self.artistid'} ],
53 { cascade_copy => 0 } # this would *so* not make sense
54);
55
d5633096 56__PACKAGE__->has_many(
57 artist_to_artwork => 'DBICTest::Schema::Artwork_to_Artist' => 'artist_id'
58);
59__PACKAGE__->many_to_many('artworks', 'artist_to_artwork', 'artwork');
60
61
aaf2403d 62sub sqlt_deploy_hook {
63 my ($self, $sqlt_table) = @_;
64
d6c79cb3 65 if ($sqlt_table->schema->translator->producer_type =~ /SQLite$/ ) {
1f5bf324 66 $sqlt_table->add_index( name => 'artist_name_hookidx', fields => ['name'] )
d6c79cb3 67 or die $sqlt_table->error;
68 }
aaf2403d 69}
c385ecea 70
a02675cd 711;