From: lpsolit%gmail.com <> Date: Wed, 22 Oct 2008 04:30:47 +0000 (+0000) Subject: Bug 460922: [Oracle] Need to drop all the FKs before dropping tables - Patch by Xiaoo... X-Git-Tag: bugzilla-3.2rc2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=400cc3ca7b1f63bd2b95af4a7b13a5eb9c257470;p=thirdparty%2Fbugzilla.git Bug 460922: [Oracle] Need to drop all the FKs before dropping tables - Patch by Xiaoou r/a=mkanat --- diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index b5fd48b289..ef3f62fcb0 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -185,6 +185,24 @@ sub sql_in { return "( " . join(" OR ", @in_str) . " )"; } +sub bz_drop_table { + my ($self, $name) = @_; + my $table_exists = $self->bz_table_info($name); + if ($table_exists) { + $self->_bz_drop_fks($name); + $self->SUPER::bz_drop_table($name); + } +} + +# Dropping all FKs for a specified table. +sub _bz_drop_fks { + my ($self, $table) = @_; + my @columns = $self->_bz_real_schema->get_table_columns($table); + foreach my $column (@columns) { + $self->bz_drop_fk($table, $column); + } +} + sub _fix_empty { my ($string) = @_; $string = '' if $string eq EMPTY_STRING;