alter_drop_constraint drop constraint, not index
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Producer / PostgreSQL.pm
index 66461f0..4838089 100644 (file)
@@ -22,7 +22,7 @@ Does not yet support PostGIS Views.
 use strict;
 use warnings;
 our ( $DEBUG, $WARN );
-our $VERSION = '1.59';
+our $VERSION = '1.60';
 $DEBUG = 0 unless defined $DEBUG;
 
 use base qw(SQL::Translator::Producer);
@@ -451,9 +451,7 @@ sub create_view {
         #
         if (is_geometry($field)) {
             foreach ( create_geometry_constraints($field, $options) ) {
-                my ($cdefs, $fks) = create_constraint($_, {
-                    generator => $generator,
-                });
+                my ($cdefs, $fks) = create_constraint($_, $options);
                 push @$constraint_defs, @$cdefs;
                 push @$fks, @$fks;
             }
@@ -653,7 +651,7 @@ sub convert_datatype
         $data_type = 'character varying';
     }
     elsif ( $field->is_auto_increment ) {
-        if ( defined $size[0] && $size[0] > 11 ) {
+        if ( (defined $size[0] && $size[0] > 11) or $data_type eq 'bigint' ) {
             $data_type = 'bigserial';
         }
         else {
@@ -924,9 +922,7 @@ sub rename_table {
 sub alter_create_index {
     my ($index, $options) = @_;
     my $generator = _generator($options);
-    my ($idef, $constraints) = create_index($index, {
-        generator => $generator,
-    });
+    my ($idef, $constraints) = create_index($index, $options);
     return $index->type eq NORMAL ? $idef
         : sprintf('ALTER TABLE %s ADD %s',
               $generator->quote($index->table->name),