Regenerate (finally\!) t/lib/sqlite.sql
[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 },
22);
ff657a43 23__PACKAGE__->set_primary_key('artistid');
a02675cd 24
90e6de6c 25__PACKAGE__->mk_classdata('field_name_for', {
26 artistid => 'primary key',
27 name => 'artist name',
28});
29
ff657a43 30__PACKAGE__->has_many(
31 cds => 'DBICTest::Schema::CD', undef,
32 { order_by => 'year' },
33);
c193d1d2 34__PACKAGE__->has_many(
35 cds_unordered => 'DBICTest::Schema::CD'
36);
ff657a43 37
38__PACKAGE__->has_many( twokeys => 'DBICTest::Schema::TwoKeys' );
39__PACKAGE__->has_many( onekeys => 'DBICTest::Schema::OneKey' );
40
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
45);
46
aaf2403d 47sub sqlt_deploy_hook {
48 my ($self, $sqlt_table) = @_;
49
d6c79cb3 50
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;
54 }
aaf2403d 55}
c385ecea 56
a02675cd 571;