]> Dogcows Code - chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate/blobdiff - t/lib/DBSchema/Result/Dvd.pm
Add unique constraints on columns referenced by foreign keys
[chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate] / t / lib / DBSchema / Result / Dvd.pm
index 0020109318b104d4a2b222c51bb3e78f02ce77f5..b355e52655c7feaf723d85d34e4a8fc94b09428a 100644 (file)
@@ -45,8 +45,10 @@ __PACKAGE__->add_columns(
   },
 );
 __PACKAGE__->set_primary_key('dvd_id');
-__PACKAGE__->belongs_to('owner', 'DBSchema::Result::User', { id => 'owner' });
-__PACKAGE__->belongs_to('current_borrower', 'DBSchema::Result::User', { id => 'current_borrower' });
+__PACKAGE__->add_unique_constraint(dvd_name => [qw(name)]);
+__PACKAGE__->add_unique_constraint(dvd_twokeys => [qw(twokeysfk)]);
+__PACKAGE__->belongs_to('owner', 'DBSchema::Result::User', 'owner');
+__PACKAGE__->belongs_to('current_borrower', 'DBSchema::Result::User', 'current_borrower', { join_type => "LEFT" });
 __PACKAGE__->has_many('dvdtags', 'Dvdtag', { 'foreign.dvd' => 'self.dvd_id' });
 __PACKAGE__->has_many('viewings', 'DBSchema::Result::Viewing', { 'foreign.dvd_id' => 'self.dvd_id' });
 __PACKAGE__->many_to_many('tags', 'dvdtags' => 'tag');
@@ -54,9 +56,10 @@ __PACKAGE__->might_have(
     liner_notes => 'DBSchema::Result::LinerNotes', undef,
     { proxy => [ qw/notes/ ] },
 );
-__PACKAGE__->add_relationship('like_has_many', 'DBSchema::Result::Twokeys', { 'foreign.dvd_name' => 'self.name' }, { accessor_name => 'like_has_many' } );
+__PACKAGE__->add_relationship('like_has_many', 'DBSchema::Result::Twokeys', { 'foreign.dvd_name' => 'self.name' }, { accessor => 'multi', accessor_name => 'like_has_many' } );
 __PACKAGE__->add_relationship('like_has_many2', 'DBSchema::Result::Twokeys_belongsto', 
     { 'foreign.key1' => 'self.twokeysfk' }, 
+    { accessor => 'multi' },
 ); 
 
 1;
This page took 0.018787 seconds and 4 git commands to generate.