From: Justin Hunter Date: Sat, 5 Sep 2009 16:48:25 +0000 (-0700) Subject: compare the type against predefined constants X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=689a129474061794b6f61a6747052461e6725e11;p=dbsrgits%2FSQL-Translator-2.0-ish.git compare the type against predefined constants --- diff --git a/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm b/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm index ed7f446..233a4d2 100644 --- a/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/DDL/PostgreSQL.pm @@ -78,10 +78,11 @@ role SQL::Translator::Parser::DDL::PostgreSQL { for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { my $constraint; - if (uc $cdata->{type} eq 'PRIMARY_KEY') { + $cdata->{type} =~ s/_/ /g; + if (uc $cdata->{type} eq PRIMARY_KEY) { $constraint = PrimaryKey->new({ name => $cdata->{name} || '', table => $table }); $table->get_column($_)->is_primary_key(1) for @{$cdata->{fields}}; - } elsif (uc $cdata->{type} eq 'FOREIGN_KEY') { + } elsif (uc $cdata->{type} eq FOREIGN_KEY) { $constraint = ForeignKey->new({ name => $cdata->{name} || '', table => $table, reference_table => $cdata->{reference_table},