summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-12-26 11:31:15 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2011-12-26 11:31:15 +0100
commit429534ee24bfbfce0c330b92e0167b4c8cff6b5f (patch)
treeb9371d4d87fbd39f9d2451061f13b40b09eb29fc /Bugzilla/Install
parente647ec0703c903e4f64fad385ff39465f6f83ce0 (diff)
downloadbugzilla-429534ee24bfbfce0c330b92e0167b4c8cff6b5f.tar.gz
bugzilla-429534ee24bfbfce0c330b92e0167b4c8cff6b5f.tar.xz
Bug 683644: Foreign keys aren't renamed correctly when DB tables are renamed
r=wicked a=LpSolit
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r--Bugzilla/Install/DB.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 010dc7ad4..f4f6e2fb6 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -3611,6 +3611,13 @@ sub _rename_tags_to_tag {
$dbh->bz_add_index('tag', 'tag_user_id_idx',
{FIELDS => [qw(user_id name)], TYPE => 'UNIQUE'});
}
+ if (my $bug_tag_fk = $dbh->bz_fk_info('bug_tag', 'tag_id')) {
+ # bz_rename_table() didn't handle FKs correctly.
+ if ($bug_tag_fk->{TABLE} eq 'tags') {
+ $bug_tag_fk->{TABLE} = 'tag';
+ $dbh->bz_alter_fk('bug_tag', 'tag_id', $bug_tag_fk);
+ }
+ }
}
sub _on_delete_set_null_for_audit_log_userid {