]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 460922: [Oracle] Need to drop all the FKs before dropping tables - Patch by Xiaoo...
authorlpsolit%gmail.com <>
Wed, 22 Oct 2008 04:30:47 +0000 (04:30 +0000)
committerlpsolit%gmail.com <>
Wed, 22 Oct 2008 04:30:47 +0000 (04:30 +0000)
Bugzilla/DB/Oracle.pm

index b5fd48b289ab0eb3fb48b767dabf7d4ed56a52ab..ef3f62fcb0b2b3c7b166171a9bd265d2656e4d03 100644 (file)
@@ -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;