]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 578197: [PostgreSQL] When associating sequences with columns, also
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 13 Jul 2010 00:38:53 +0000 (17:38 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 13 Jul 2010 00:38:53 +0000 (17:38 -0700)
fix the default of the columns so that it's identical to what a new
checksetup run would create.
r=mkanat, a=mkanat (module owner)

Bugzilla/DB/Pg.pm

index 8ed7368aadb1d06938885d2b2836d5b9e86d7781..0373fb1ce0501afbb52d07d3f5b79f763614a7b8 100644 (file)
@@ -296,6 +296,12 @@ END
                 print "Fixing $sequence to be associated"
                       . " with $table.$column...\n";
                 $self->do("ALTER SEQUENCE $sequence OWNED BY $table.$column");
+                # In order to produce an exactly identical schema to what
+                # a brand-new checksetup.pl run would produce, we also need
+                # to re-set the default on this column.
+                $self->do("ALTER TABLE $table
+                          ALTER COLUMN $column
+                           SET DEFAULT nextval('$sequence')");
             }
         }
     }