From 62d123f695e334fbb8f0d23ad214cfc05ed37518 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 18 Nov 2009 07:08:33 +0000 Subject: 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 --- Bugzilla/DB.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index b8a638e24..7e40c1627 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); -- cgit v1.2.3-24-g4f1b