summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-09 01:43:22 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-09 01:43:22 +0200
commitdf3d17375606c39012eaeb0804663364856c495d (patch)
tree31a03aa418ea481b0adb291b3ab7708cd7218a1b /Bugzilla
parentd500177f7ce877bf1f535df96c1231651355e199 (diff)
downloadbugzilla-df3d17375606c39012eaeb0804663364856c495d.tar.gz
bugzilla-df3d17375606c39012eaeb0804663364856c495d.tar.xz
Bug 577577: Make bz_drop_fk be tolerant of SQL failure
r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/DB.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index de688e6fc..b1d8ca401 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -771,8 +771,14 @@ sub bz_drop_fk {
print get_text('install_fk_drop',
{ table => $table, column => $column, fk => $def })
. "\n" if Bugzilla->usage_mode == USAGE_MODE_CMDLINE;
- my @sql = $self->_bz_real_schema->get_drop_fk_sql($table,$column,$def);
- $self->do($_) foreach @sql;
+ my @statements =
+ $self->_bz_real_schema->get_drop_fk_sql($table,$column,$def);
+ foreach my $sql (@statements) {
+ # Because this is a deletion, we don't want to die hard if
+ # we fail because of some local customization. If something
+ # is already gone, that's fine with us!
+ eval { $self->do($sql); } or warn "Failed SQL: [$sql] Error: $@";
+ }
delete $col_def->{REFERENCES};
$self->_bz_real_schema->set_column($table, $column, $col_def);
$self->_bz_store_real_schema;