package SQL::Translator::Parser::DBI::PostgreSQL;
# -------------------------------------------------------------------
-# $Id: PostgreSQL.pm,v 1.9 2005-10-07 16:26:41 scottcain Exp $
+# $Id: PostgreSQL.pm,v 1.10 2007-06-04 04:01:14 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use SQL::Translator::Schema::Constants;
use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
# -------------------------------------------------------------------
my $col = $table->add_field(
name => $$columnhash{'attname'},
default_value => $$columnhash{'adsrc'},
- data_type => $$columnhash{'typename'},
+ data_type => $$columnhash{'typname'},
order => $$columnhash{'attnum'},
) || die $table->error;
$col->{size} = [$$columnhash{'length'}] if $$columnhash{'length'}>0;
- $col->{is_nullable} = 1 unless $$columnhash{'attnotnull'};
+ $col->{is_nullable} = $$columnhash{'attnotnull'} ? 0 : 1;
}
$index_select->execute($table_oid);
package SQL::Translator::Producer::PostgreSQL;
# -------------------------------------------------------------------
-# $Id: PostgreSQL.pm,v 1.28 2006-11-20 23:56:14 schiffbruechige Exp $
+# $Id: PostgreSQL.pm,v 1.29 2007-06-04 04:01:14 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use warnings;
use vars qw[ $DEBUG $WARN $VERSION ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.28 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.29 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 1 unless defined $DEBUG;
use SQL::Translator::Schema::Constants;
# print STDERR "$table_name table_name\n";
my ( @comments, @field_defs, @sequence_defs, @constraint_defs, @fks );
- push @comments, "--\n-- Table: $table_name_ur\n--" unless $no_comments;
+ push @comments, "--\n-- Table: $table_name_ur\n--\n" unless $no_comments;
if ( $table->comments and !$no_comments ){
my $c = "-- Comments: \n-- ";
$c .= join "\n-- ", $table->comments;
- $c .= "\n--";
+ $c .= "\n--\n";
push @comments, $c;
}
quote_table_names => $qt,
table_name => $table_name,
});
- push @index_defs, $idef;
+ $idef and push @index_defs, $idef;
push @constraint_defs, @$constraints;
}