From: Max Kanat-Alexander Date: Sat, 10 Jul 2010 04:10:46 +0000 (-0700) Subject: Bug 451219: Allow altering from one SERIAL type to another on PostgreSQL, X-Git-Tag: bugzilla-3.6.2~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ee58be28d5b890cf704001dcf14e470bd37cbcc;p=thirdparty%2Fbugzilla.git Bug 451219: Allow altering from one SERIAL type to another on PostgreSQL, for people upgrading Testopia from 1.3 to 2.0+. r=mkanat, a=mkanat (module owner) --- diff --git a/Bugzilla/DB/Schema/Pg.pm b/Bugzilla/DB/Schema/Pg.pm index 3559bae9c9..0b10acbb09 100644 --- a/Bugzilla/DB/Schema/Pg.pm +++ b/Bugzilla/DB/Schema/Pg.pm @@ -136,9 +136,10 @@ sub _get_alter_type_sql { if ($type =~ /serial/i && $old_def->{TYPE} !~ /serial/i) { die("You cannot specify a DEFAULT on a SERIAL-type column.") if $new_def->{DEFAULT}; - $type =~ s/serial/integer/i; } + $type =~ s/\bserial\b/integer/i; + # On Pg, you don't need UNIQUE if you're a PK--it creates # two identical indexes otherwise. $type =~ s/unique//i if $new_def->{PRIMARYKEY};