From: Justin Hunter Date: Mon, 18 Jan 2010 01:35:51 +0000 (-0700) Subject: primary key fix X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=49eb21a3a6910bf8f7109fbfb06f7bb20c4eff33;p=dbsrgits%2FSQL-Translator-2.0-ish.git primary key fix --- diff --git a/lib/SQL/Translator/Parser/DDL/MySQL.pm b/lib/SQL/Translator/Parser/DDL/MySQL.pm index b7e05a0..e577f33 100644 --- a/lib/SQL/Translator/Parser/DDL/MySQL.pm +++ b/lib/SQL/Translator/Parser/DDL/MySQL.pm @@ -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 ], diff --git a/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm b/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm index 0c3dbe7..95f6cc7 100644 --- a/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm @@ -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'; diff --git a/lib/SQL/Translator/Parser/DDL/XML.pm b/lib/SQL/Translator/Parser/DDL/XML.pm index a21c560..a53a405 100644 --- a/lib/SQL/Translator/Parser/DDL/XML.pm +++ b/lib/SQL/Translator/Parser/DDL/XML.pm @@ -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: