]> Dogcows Code - chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate/blob - t/lib/DBICTest/Schema/Artist.pm
tests from multicreate
[chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate] / 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__->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 });
12 __PACKAGE__->add_columns(
13 'artistid' => {
14 data_type => 'integer',
15 is_auto_increment => 1,
16 },
17 'name' => {
18 data_type => 'varchar',
19 size => 100,
20 is_nullable => 1,
21 },
22 rank => {
23 data_type => 'integer',
24 default_value => 13,
25 },
26 charfield => {
27 data_type => 'char',
28 size => 10,
29 is_nullable => 1,
30 },
31 );
32 __PACKAGE__->set_primary_key('artistid');
33
34 __PACKAGE__->mk_classdata('field_name_for', {
35 artistid => 'primary key',
36 name => 'artist name',
37 });
38
39 __PACKAGE__->has_many(
40 cds => 'DBICTest::Schema::CD', undef,
41 { order_by => 'year' },
42 );
43 __PACKAGE__->has_many(
44 cds_unordered => 'DBICTest::Schema::CD'
45 );
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
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
62 sub sqlt_deploy_hook {
63 my ($self, $sqlt_table) = @_;
64
65
66 if ($sqlt_table->schema->translator->producer_type =~ /SQLite$/ ) {
67 $sqlt_table->add_index( name => 'artist_name', fields => ['name'] )
68 or die $sqlt_table->error;
69 }
70 }
71
72 __PACKAGE__->resultset_class( __PACKAGE__ . '::ResultSet');
73
74 package DBICTest::Schema::Artist::ResultSet;
75
76 use base qw( DBIx::Class::ResultSet::RecursiveUpdate );
77
78
79 1;
This page took 0.033663 seconds and 4 git commands to generate.