From: Rafael Kitover Date: Fri, 23 Jul 2010 10:09:23 +0000 (-0400) Subject: put is_deferrable => 1 back into default attributes for belongs_to X-Git-Tag: 0.07001~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=aa0867ee7faa8246a6552861b61bea59c6483487 put is_deferrable => 1 back into default attributes for belongs_to --- diff --git a/Changes b/Changes index 88c750d..ae8922c 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - put is_deferrable => 1 back into default attributes for belongs_to - fix Postgres sequence detection for qualified sequences - detect DOS line ends in table/column comments and convert to \n - added use_moose option diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 949f6b1..ee75f06 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -260,10 +260,10 @@ relationship types override those set in 'all'. For example: relationship_attrs => { - belongs_to => { is_deferrable => 1 }, + belongs_to => { is_deferrable => 0 }, }, -use this to make your foreign key constraints DEFERRABLE. +use this to turn off DEFERRABLE on your foreign key constraints. =head2 debug diff --git a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm index e3475dd..a20fe16 100644 --- a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm +++ b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm @@ -164,7 +164,7 @@ sub _default_relationship_attrs { +{ belongs_to => { on_delete => 'CASCADE', on_update => 'CASCADE', -# is_deferrable => 1, + is_deferrable => 1, }, } } diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 3b951ba..49137d6 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -633,8 +633,8 @@ sub test_schema { is $rsobj4->result_source->relationship_info('fkid_singular')->{attrs}{on_update}, 'CASCADE', "on_update => 'CASCADE' on belongs_to by default"; - ok ((not exists $rsobj4->result_source->relationship_info('fkid_singular')->{attrs}{is_deferrable}), - "is_deferrable => 1 not on belongs_to by default"); + is $rsobj4->result_source->relationship_info('fkid_singular')->{attrs}{is_deferrable}, 1, + "is_deferrable => 1 on belongs_to by default"; ok ((not exists $rsobj4->result_source->relationship_info('fkid_singular')->{attrs}{cascade_delete}), 'belongs_to does not have cascade_delete');