]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 527489: Calls to bz_alter_column were dropping the REFERENCES item from the store...
authormkanat%bugzilla.org <>
Wed, 18 Nov 2009 07:08:33 +0000 (07:08 +0000)
committermkanat%bugzilla.org <>
Wed, 18 Nov 2009 07:08:33 +0000 (07:08 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=ghendricks, a=mkanat

Bugzilla/DB.pm

index b8a638e24d6cdb6a3fc31ef805b509668a0415cd..7e40c1627892d946f6b58f4c171d25167459f92b 100644 (file)
@@ -537,6 +537,13 @@ sub bz_alter_column {
             ThrowCodeError('column_not_null_no_default_alter', 
                            { name => "$table.$name" }) if ($any_nulls);
         }
+        # Preserve foreign key definitions in the Schema object when altering
+        # types.
+        if (defined $current_def->{REFERENCES}) {
+            # Make sure we don't modify the caller's $new_def.
+            $new_def = dclone($new_def);
+            $new_def->{REFERENCES} = $current_def->{REFERENCES};
+        }
         $self->bz_alter_column_raw($table, $name, $new_def, $current_def,
                                    $set_nulls_to);
         $self->_bz_real_schema->set_column($table, $name, $new_def);