From: Peter Rabbitson Date: Fri, 5 Sep 2014 09:05:46 +0000 (+0200) Subject: Move and simplify a chunk of parser code X-Git-Tag: v0.082800~60 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f077f920ee12a9d4decc8a6653517f2a276151b;p=dbsrgits%2FDBIx-Class.git Move and simplify a chunk of parser code No functional changes --- diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 4fd03f2..5a846c0 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -186,9 +186,6 @@ sub parse { # support quoting properly to be signaled about this $rel_table = $$rel_table if ref $rel_table eq 'SCALAR'; - my $reverse_rels = $source->reverse_relationship_info($rel); - my ($otherrelname, $otherrelationship) = each %{$reverse_rels}; - # Force the order of @cond to match the order of ->add_columns my $idx; my %other_columns_idx = map {'foreign.'.$_ => ++$idx } $relsource->columns; @@ -217,6 +214,8 @@ sub parse { $fk_constraint = not $source->_compare_relationship_keys(\@keys, \@primary); } + my ($otherrelname, $otherrelationship) = %{ $source->reverse_relationship_info($rel) }; + my $cascade; for my $c (qw/delete update/) { if (exists $rel_info->{attrs}{"on_$c"}) {