primary key fix
Justin Hunter [Mon, 18 Jan 2010 01:35:51 +0000 (18:35 -0700)]
lib/SQL/Translator/Parser/DDL/MySQL.pm
lib/SQL/Translator/Parser/DDL/PostgreSQL.pm
lib/SQL/Translator/Parser/DDL/XML.pm

index b7e05a0..e577f33 100644 (file)
@@ -70,7 +70,7 @@ role SQL::Translator::Parser::DDL::MySQL {
                 $field->comments($fdata->{comments});
                 $table->add_column($field);
     
-                $table->primary_key( $field->name ) if $fdata->{'is_primary_key'};
+                $field->is_primary_key(1) if $fdata->{is_primary_key};
 
                 my %extra;
                 for my $qual ( qw[ binary unsigned zerofill list collate ],
index 0c3dbe7..95f6cc7 100644 (file)
@@ -58,7 +58,7 @@ role SQL::Translator::Parser::DDL::PostgreSQL {
                 $field->comments($fdata->{comments});
 
                 $table->add_column($field);
-                $table->primary_key($field->name) if $fdata->{is_primary_key};
+                $field->is_primary_key(1) if $fdata->{is_primary_key};
     
                 for my $cdata ( @{ $fdata->{constraints} } ) {
                     next unless lc $cdata->{type} eq 'foreign_key';
index a21c560..a53a405 100644 (file)
@@ -76,7 +76,7 @@ multi method parse(Any $data) {
             my $field = Column->new(%fdata);
             $table->add_column($field);
 
-            $table->primary_key( $field->name ) if $fdata{'is_primary_key'};
+            $field->is_primary_key(1) if $fdata{is_primary_key};
 
             #
             # TODO: