diff options
author | 2010-10-15 02:05:52 +0200 | |
---|---|---|
committer | 2010-10-15 02:05:52 +0200 | |
commit | e60d388f70533d0efd0632f39aadddcb2590a171 (patch) | |
tree | d850ba31eb36000955a4f4eeae070e83d104b756 /Bugzilla/DB.pm | |
parent | Bug 575947: Users with passwords length less than 6 characters can't login af... (diff) | |
download | bugzilla-e60d388f70533d0efd0632f39aadddcb2590a171.tar.gz bugzilla-e60d388f70533d0efd0632f39aadddcb2590a171.tar.bz2 bugzilla-e60d388f70533d0efd0632f39aadddcb2590a171.zip |
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.pm')
-rw-r--r-- | Bugzilla/DB.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 27644fba5..0290623d2 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -933,10 +933,16 @@ sub bz_drop_index { my $index_exists = $self->bz_index_info($table, $name); if ($index_exists) { + # We cannot delete an index used by a FK. + foreach my $column (@{$index_exists->{FIELDS}}) { + $self->bz_drop_related_fks($table, $column); + } $self->bz_drop_index_raw($table, $name); $self->_bz_real_schema->delete_index($table, $name); $self->_bz_store_real_schema; } + + return $index_exists ? 1 : 0; } # bz_drop_index_raw($table, $name, $silent) |