[Dbix-class] Column ordering in DBIC::Schema::Loader dumped schemas

A. Pagaltzis pagaltzis at gmx.de
Wed Jul 19 13:00:45 CEST 2006


* Nilson Santos Figueiredo Junior <acid06 at gmail.com> [2006-07-19 08:25]:
> Attached you'll find a patch for
> DBIx::Class::Schema::Loader::Base which maintains the column
> ordering as it was found on the database when dumping the
> schema.

I see your patch and raise you this one.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;
-------------- next part --------------
Index: Base.pm
===================================================================
--- Base.pm	(revision 2211)
+++ Base.pm	(working copy)
@@ -493,11 +493,8 @@
             $self->_dbic_stmt($table_class,'add_columns',@$cols);
         }
         else {
-            my %cols_hash;
-            foreach my $col (@$cols) {
-                $cols_hash{$col} = \%{($col_info->{$col})};
-            }
-            $self->_dbic_stmt($table_class,'add_columns',%cols_hash);
+            my @cols_array = map { $_, \%{($col_info->{$_})} } @$cols;
+            $self->_dbic_stmt($table_class,'add_columns', @cols_array);
         }
 
         my $pks = $self->_table_pk_info($table) || [];


More information about the Dbix-class mailing list