X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest%2FSchema%2FCD.pm;h=6f91932a6f47ecb053f2d7d68914f743bf14eab3;hb=370f2ba2727791641c350a20e4fd09469503dbae;hp=2530c7c13dd96b31bae550792e125ed36a02a30d;hpb=13de943d1aef0b4c2ff28505fc61c90b463302fb;p=dbsrgits%2FDBIx-Class.git diff --git a/t/lib/DBICTest/Schema/CD.pm b/t/lib/DBICTest/Schema/CD.pm index 2530c7c..6f91932 100644 --- a/t/lib/DBICTest/Schema/CD.pm +++ b/t/lib/DBICTest/Schema/CD.pm @@ -20,11 +20,18 @@ __PACKAGE__->add_columns( data_type => 'varchar', size => 100, }, + 'genreid' => { + data_type => 'integer' + } ); __PACKAGE__->set_primary_key('cdid'); __PACKAGE__->add_unique_constraint([ qw/artist title/ ]); -__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { is_deferrable => 1 } ); +__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { + is_deferrable => 1, + on_delete => undef, + on_update => 'SET NULL', +}); __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' ); __PACKAGE__->has_many( @@ -45,4 +52,11 @@ __PACKAGE__->many_to_many( { order_by => 'producer.name' }, ); +__PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', { 'foreign.genreid' => 'self.genreid' }); + +#__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre', +# { 'foreign.genreid' => 'self.genreid' }, +# { 'accessor' => 'single' } +#); + 1;