diff options
author | mkanat%bugzilla.org <> | 2009-11-18 08:08:33 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-11-18 08:08:33 +0100 |
commit | 62d123f695e334fbb8f0d23ad214cfc05ed37518 (patch) | |
tree | 916baf997a65190b70ad79b0a271ff3b2de3f628 | |
parent | 3606f75dd1d18e5a3419c0b679ba3288fd203cf5 (diff) | |
download | bugzilla-62d123f695e334fbb8f0d23ad214cfc05ed37518.tar.gz bugzilla-62d123f695e334fbb8f0d23ad214cfc05ed37518.tar.xz |
Bug 527489: Calls to bz_alter_column were dropping the REFERENCES item from the stored Schema object.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=ghendricks, a=mkanat
-rw-r--r-- | Bugzilla/DB.pm | 7 |
1 files changed, 7 insertions, 0 deletions
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); |