From: Ken Youens-Clark Date: Wed, 20 Aug 2003 18:58:54 +0000 (+0000) Subject: Fixed bug where the "is_auto_increment" flag wasn't being set for serial X-Git-Tag: v0.04~281 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7eac5e125b6b1c33b608894362ec692d8a6fd63e;p=dbsrgits%2FSQL-Translator.git Fixed bug where the "is_auto_increment" flag wasn't being set for serial fields, other cosmetic changes. --- diff --git a/lib/SQL/Translator/Parser/PostgreSQL.pm b/lib/SQL/Translator/Parser/PostgreSQL.pm index 6fcd174..39f5691 100644 --- a/lib/SQL/Translator/Parser/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/PostgreSQL.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::PostgreSQL; # ------------------------------------------------------------------- -# $Id: PostgreSQL.pm,v 1.27 2003-08-17 00:46:23 rossta Exp $ +# $Id: PostgreSQL.pm,v 1.28 2003-08-20 18:58:54 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # Allen Day , @@ -111,7 +111,7 @@ View table: use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.27 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.28 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -290,15 +290,16 @@ field : comment(s?) field_name data_type field_meta(s?) comment(s?) my @comments = ( @{ $item[1] }, @{ $item[5] } ); $return = { - type => 'field', - name => $item{'field_name'}, - data_type => $item{'data_type'}{'type'}, - size => $item{'data_type'}{'size'}, - null => $null, - default => $default->{'value'}, - constraints => [ @constraints ], - comments => [ @comments ], - is_primary_key => $is_pk || 0, + type => 'field', + name => $item{'field_name'}, + data_type => $item{'data_type'}{'type'}, + size => $item{'data_type'}{'size'}, + null => $null, + default => $default->{'value'}, + constraints => [ @constraints ], + comments => [ @comments ], + is_primary_key => $is_pk || 0, + is_auto_increment => $item{'data_type'}{'is_auto_increment'}, } } | @@ -428,18 +429,18 @@ pg_data_type : /(bigserial|serial8)/i { $return = { - type => 'integer', - size => [8], - auto_increment => 1, + type => 'integer', + size => [8], + is_auto_increment => 1, }; } | /serial4?/i { $return = { - type => 'integer', - size => [4], - auto_increment => 1, + type => 'integer', + size => [4], + is_auto_increment => 1, }; } | @@ -719,7 +720,7 @@ sub parse { data_type => $fdata->{'data_type'}, size => $fdata->{'size'}, default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, + is_auto_increment => $fdata->{'is_auto_increment'}, is_nullable => $fdata->{'null'}, ) or die $table->error;