From: Justin Hunter Date: Thu, 3 Dec 2009 15:36:28 +0000 (-0800) Subject: make sure reference_fields/reference_columns is not undef X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2913dc4591deb5a32cae9f5dab76eb0608eebb34;p=dbsrgits%2FSQL-Translator-2.0-ish.git make sure reference_fields/reference_columns is not undef --- diff --git a/lib/SQL/Translator/Parser/DDL/MySQL.pm b/lib/SQL/Translator/Parser/DDL/MySQL.pm index 1ec752a..b7e05a0 100644 --- a/lib/SQL/Translator/Parser/DDL/MySQL.pm +++ b/lib/SQL/Translator/Parser/DDL/MySQL.pm @@ -136,7 +136,7 @@ role SQL::Translator::Parser::DDL::MySQL { $constraint = ForeignKey->new({ name => $cdata->{name} || '', table => $table, reference_table => $cdata->{reference_table}, - reference_columns => $cdata->{reference_fields}, + defined $cdata->{reference_fields} ? (reference_columns => $cdata->{reference_fields}) : (), on_delete => $cdata->{on_delete} || $cdata->{on_delete_do}, on_update => $cdata->{on_update} || $cdata->{on_update_do} }); $table->get_column($_)->is_foreign_key(1) for @{$cdata->{fields}};