From: mkanat%bugzilla.org <> Date: Wed, 18 Nov 2009 07:08:33 +0000 (+0000) Subject: Bug 527489: Calls to bz_alter_column were dropping the REFERENCES item from the store... X-Git-Tag: bugzilla-3.5.2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62d123f695e334fbb8f0d23ad214cfc05ed37518;p=thirdparty%2Fbugzilla.git Bug 527489: Calls to bz_alter_column were dropping the REFERENCES item from the stored Schema object. Patch by Max Kanat-Alexander r=ghendricks, a=mkanat --- diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index b8a638e24d..7e40c16278 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -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);