From: Ash Berlin Date: Mon, 17 Mar 2008 21:56:47 +0000 (+0000) Subject: Fix test to reflect correct default state for deferrable constraints in SQL::T X-Git-Tag: v0.08240~507 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e394339bfc6e2334df17a0994424f5d0f5d9e0d1;p=dbsrgits%2FDBIx-Class.git Fix test to reflect correct default state for deferrable constraints in SQL::T --- diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 94b241e..dc18bbb 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -185,7 +185,7 @@ sub parse { reference_table => $rel_table, on_delete => $on_delete, on_update => $on_update, - defined $is_deferrable ? ( deferrable => $is_deferrable ) : (), + (defined $is_deferrable ? ( deferrable => $is_deferrable ) : ()), ); my $index = $table->add_index( diff --git a/t/86sqlt.t b/t/86sqlt.t index 079a252..987ee39 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -48,7 +48,7 @@ my %fk_constraints = ( 'display' => 'twokeys->artist', 'selftable' => 'twokeys', 'foreigntable' => 'artist', 'selfcols' => ['artist'], 'foreigncols' => ['artistid'], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, ], @@ -58,14 +58,14 @@ my %fk_constraints = ( 'display' => 'fourkeys_to_twokeys->twokeys', 'selftable' => 'fourkeys_to_twokeys', 'foreigntable' => 'twokeys', 'selfcols' => ['t_artist', 't_cd'], 'foreigncols' => ['artist', 'cd'], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, { 'display' => 'fourkeys_to_twokeys->fourkeys', 'selftable' => 'fourkeys_to_twokeys', 'foreigntable' => 'fourkeys', 'selfcols' => [qw(f_foo f_bar f_hello f_goodbye)], 'foreigncols' => [qw(foo bar hello goodbye)], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, ], @@ -75,13 +75,13 @@ my %fk_constraints = ( 'display' => 'cd_to_producer->cd', 'selftable' => 'cd_to_producer', 'foreigntable' => 'cd', 'selfcols' => ['cd'], 'foreigncols' => ['cdid'], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, { 'display' => 'cd_to_producer->producer', 'selftable' => 'cd_to_producer', 'foreigntable' => 'producer', 'selfcols' => ['producer'], 'foreigncols' => ['producerid'], - on_delete => '', on_update => '', deferrable => 0, + on_delete => '', on_update => '', deferrable => 1, }, ], @@ -91,13 +91,13 @@ my %fk_constraints = ( 'display' => 'self_ref_alias->self_ref for self_ref', 'selftable' => 'self_ref_alias', 'foreigntable' => 'self_ref', 'selfcols' => ['self_ref'], 'foreigncols' => ['id'], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, { 'display' => 'self_ref_alias->self_ref for alias', 'selftable' => 'self_ref_alias', 'foreigntable' => 'self_ref', 'selfcols' => ['alias'], 'foreigncols' => ['id'], - on_delete => '', on_update => '', deferrable => 0, + on_delete => '', on_update => '', deferrable => 1, }, ], @@ -117,13 +117,13 @@ my %fk_constraints = ( 'display' => 'artist_undirected_map->artist for id1', 'selftable' => 'artist_undirected_map', 'foreigntable' => 'artist', 'selfcols' => ['id1'], 'foreigncols' => ['artistid'], - on_delete => 'CASCADE', on_update => '', deferrable => 0, + on_delete => 'CASCADE', on_update => '', deferrable => 1, }, { 'display' => 'artist_undirected_map->artist for id2', 'selftable' => 'artist_undirected_map', 'foreigntable' => 'artist', 'selfcols' => ['id2'], 'foreigncols' => ['artistid'], - on_delete => 'CASCADE', on_update => '', deferrable => 0, + on_delete => 'CASCADE', on_update => '', deferrable => 1, }, ], @@ -133,7 +133,7 @@ my %fk_constraints = ( 'display' => 'track->cd', 'selftable' => 'track', 'foreigntable' => 'cd', 'selfcols' => ['cd'], 'foreigncols' => ['cdid'], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, ], @@ -143,7 +143,7 @@ my %fk_constraints = ( 'display' => 'treelike->treelike for parent', 'selftable' => 'treelike', 'foreigntable' => 'treelike', 'selfcols' => ['parent'], 'foreigncols' => ['id'], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, ], @@ -153,7 +153,7 @@ my %fk_constraints = ( 'display' => 'twokeytreelike->twokeytreelike for parent1,parent2', 'selftable' => 'twokeytreelike', 'foreigntable' => 'twokeytreelike', 'selfcols' => ['parent1', 'parent2'], 'foreigncols' => ['id1','id2'], - on_delete => '', on_update => '', deferrable => 0, + on_delete => '', on_update => '', deferrable => 1, }, ], @@ -163,7 +163,7 @@ my %fk_constraints = ( 'display' => 'tags->cd', 'selftable' => 'tags', 'foreigntable' => 'cd', 'selfcols' => ['cd'], 'foreigncols' => ['cdid'], - on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 0, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, ], @@ -173,7 +173,7 @@ my %fk_constraints = ( 'display' => 'bookmark->link', 'selftable' => 'bookmark', 'foreigntable' => 'link', 'selfcols' => ['link'], 'foreigncols' => ['id'], - on_delete => '', on_update => '', deferrable => 0, + on_delete => '', on_update => '', deferrable => 1, }, ], # ForceForeign @@ -182,7 +182,7 @@ my %fk_constraints = ( 'display' => 'forceforeign->artist', 'selftable' => 'forceforeign', 'foreigntable' => 'artist', 'selfcols' => ['artist'], 'foreigncols' => ['artist_id'], - on_delete => '', on_update => '', deferrable => 0, + on_delete => '', on_update => '', deferrable => 1, }, ], diff --git a/t/lib/DBICTest/Schema/TwoKeys.pm b/t/lib/DBICTest/Schema/TwoKeys.pm index 7bb1965..b6dedf0 100755 --- a/t/lib/DBICTest/Schema/TwoKeys.pm +++ b/t/lib/DBICTest/Schema/TwoKeys.pm @@ -11,7 +11,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key(qw/artist cd/); __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' ); -__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD' ); +__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', undef, { is_deferrable => 0 } ); __PACKAGE__->has_many( 'fourkeys_to_twokeys', 'DBICTest::Schema::FourKeys_to_TwoKeys', {