X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest%2FSchema%2FTwoKeys.pm;h=bfb6c42b106ce27472de6f33ed6103e132e86856;hb=6c99a3eea0da8f254e67fdda21e27f9ef9fbeec3;hp=12943b80add0a0ce40d7876cdc36b45500f04c00;hpb=a02675cd9a11e1f354220319da9f5d573a2e484a;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/lib/DBICTest/Schema/TwoKeys.pm b/t/lib/DBICTest/Schema/TwoKeys.pm index 12943b8..bfb6c42 100755 --- a/t/lib/DBICTest/Schema/TwoKeys.pm +++ b/t/lib/DBICTest/Schema/TwoKeys.pm @@ -1,17 +1,30 @@ -package DBICTest::TwoKeys; +package # hide from PAUSE + DBICTest::Schema::TwoKeys; -use base 'DBIx::Class::Core'; +use base qw/DBICTest::BaseResult/; -DBICTest::TwoKeys->table('twokeys'); -DBICTest::TwoKeys->add_columns(qw/artist cd/); -DBICTest::TwoKeys->set_primary_key(qw/artist cd/); -DBICTest::TwoKeys->add_relationship( - artist => 'DBICTest::Artist', - { 'foreign.artistid' => 'self.artist' } +__PACKAGE__->table('twokeys'); +__PACKAGE__->add_columns( + 'artist' => { data_type => 'integer' }, + 'cd' => { data_type => 'integer' }, ); -DBICTest::TwoKeys->add_relationship( - cd => 'DBICTest::CD', - { 'foreign.cdid' => 'self.cd' } +__PACKAGE__->set_primary_key(qw/artist cd/); + +__PACKAGE__->belongs_to( + artist => 'DBICTest::Schema::Artist', + {'foreign.artistid'=>'self.artist'}, +); + +__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', undef, { is_deferrable => 0, add_fk_index => 0 } ); + +__PACKAGE__->has_many( + 'fourkeys_to_twokeys', 'DBICTest::Schema::FourKeys_to_TwoKeys', { + 'foreign.t_artist' => 'self.artist', + 'foreign.t_cd' => 'self.cd', +}); + +__PACKAGE__->many_to_many( + 'fourkeys', 'fourkeys_to_twokeys', 'fourkeys', ); 1;