From: Justin Hunter Date: Wed, 27 Jan 2010 07:19:32 +0000 (-0800) Subject: make sure columns is an ARRAYREF X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dff43bbb48132f86adc48f0833b3656b4a0f4137;p=dbsrgits%2FSQL-Translator-2.0-ish.git make sure columns is an ARRAYREF --- diff --git a/lib/SQL/Translator/Parser/DDL/YAML.pm b/lib/SQL/Translator/Parser/DDL/YAML.pm index 74b28cc..1d9d448 100644 --- a/lib/SQL/Translator/Parser/DDL/YAML.pm +++ b/lib/SQL/Translator/Parser/DDL/YAML.pm @@ -60,8 +60,9 @@ role SQL::Translator::Parser::DDL::YAML { for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { $cdata->{table} = $table; - $cdata->{reference_columns} = delete $cdata->{reference_fields}; + $cdata->{reference_columns} = delete $cdata->{reference_fields} || []; my $columns = delete $cdata->{fields} || []; + $columns = ref $columns eq 'ARRAY' ? $columns : [ $columns ]; my $constraint = Constraint->new($cdata); $constraint->add_column($table->get_column($_)) for @$columns; $table->add_constraint($constraint);