add schema to Table->new and remove sorting
Justin Hunter [Sun, 23 Aug 2009 07:05:01 +0000 (00:05 -0700)]
lib/SQL/Translator/Parser/DDL/PostgreSQL.pm

index e049e82..87441e0 100644 (file)
@@ -33,15 +33,13 @@ sort { ( $result->{tables}{ $a }{'order'} || 0 ) <=> ( $result->{tables}{ $b }{'
     
         for my $table_name ( @tables ) {
             my $tdata = $result->{tables}{ $table_name };
-            my $table = Table->new({ name => $tdata->{table_name} });
+            my $table = Table->new({ name => $tdata->{table_name}, schema => $schema });
             $schema->add_table($table);
     
             $table->extra(temporary => 1) if $tdata->{'temporary'};
             $table->comments( $tdata->{'comments'} );
     
-            my @fields = 
-sort { $tdata->{'fields'}{ $a }{'order'} <=> $tdata->{'fields'}{ $b }{'order'} }
-            keys %{ $tdata->{'fields'} };
+            my @fields = sort { $tdata->{'fields'}{ $a }{'order'} <=> $tdata->{'fields'}{ $b }{'order'} } keys %{ $tdata->{'fields'} };
     
             for my $fname ( @fields ) {
                 my $fdata = $tdata->{'fields'}{ $fname };