summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2010-10-15 02:05:52 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2010-10-15 02:05:52 +0200
commite60d388f70533d0efd0632f39aadddcb2590a171 (patch)
treed850ba31eb36000955a4f4eeae070e83d104b756 /Bugzilla/DB
parent73ea75885de78077c9528428617fa8403935d7a5 (diff)
downloadbugzilla-e60d388f70533d0efd0632f39aadddcb2590a171.tar.gz
bugzilla-e60d388f70533d0efd0632f39aadddcb2590a171.tar.xz
Bug 451735 part2: fix bz_drop_index() so that it first drops related FKs before deleting the index itself
r/a=mkanat
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Mysql.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm
index 7b7e4e9b9..6fd75b79f 100644
--- a/Bugzilla/DB/Mysql.pm
+++ b/Bugzilla/DB/Mysql.pm
@@ -765,6 +765,22 @@ sub bz_setup_database {
}
$self->_fix_defaults();
+
+ # Bug 451735 highlighted a bug in bz_drop_index() which didn't
+ # check for FKs before trying to delete an index. Consequently,
+ # the series_creator_idx index was considered to be deleted
+ # despite it was still present in the DB. That's why we have to
+ # force the deletion, bypassing the DB schema.
+ if (!$self->bz_index_info('series', 'series_category_idx')) {
+ if (!$self->bz_drop_index('series', 'series_creator_idx')
+ && $self->bz_index_info_real('series', 'series_creator_idx'))
+ {
+ foreach my $column (qw(creator category subcategory name)) {
+ $self->bz_drop_related_fks('series', $column);
+ }
+ $self->bz_drop_index_raw('series', 'series_creator_idx');
+ }
+ }
}
# When you import a MySQL 3/4 mysqldump into MySQL 5, columns that