summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-04-17 16:27:06 +0200
committermkanat%kerio.com <>2005-04-17 16:27:06 +0200
commitf18c6f0b18359a7b3e525bf398f51ccb1773c86f (patch)
tree4e68ca33956297dfced2e0a2b4183cb0369d067f /Bugzilla/DB.pm
parent8231d98d0644c387ea8476f61b4a3301848403d9 (diff)
downloadbugzilla-f18c6f0b18359a7b3e525bf398f51ccb1773c86f.tar.gz
bugzilla-f18c6f0b18359a7b3e525bf398f51ccb1773c86f.tar.xz
Bug 290411: Cross-DB bz_drop_table
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=Tomas.Kopal, a=justdave
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index a32406d5b..42328c9ea 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -569,6 +569,21 @@ sub bz_drop_index_raw {
$self->do($_) foreach (@statements);
}
+sub bz_drop_table {
+ my ($self, $name) = @_;
+
+ my $table_exists = $self->bz_table_info($name);
+
+ if ($table_exists) {
+ my @statements = $self->_bz_schema->get_drop_table_ddl($name);
+ print "Dropping table $name...\n";
+ $self->do($_) foreach (@statements);
+ $self->_bz_real_schema->delete_table($name);
+ $self->_bz_store_real_schema;
+ }
+}
+
+
# XXX - Needs to be made cross-db compatible
sub bz_drop_table_indexes ($) {
my ($self, $table) = @_;
@@ -1006,6 +1021,7 @@ Bugzilla::DB - Database access routines, using L<DBI>
$dbh->bz_add_index($table, $name, $definition);
$dbh->bz_add_table($name);
$dbh->bz_drop_index($table, $name);
+ $dbh->bz_drop_table($name);
$dbh->bz_alter_column($table, $name, \%new_def);
$dbh->bz_drop_column($table, $column);
$dbh->bz_rename_column($table, $old_name, $new_name);
@@ -1363,6 +1379,13 @@ C<Bugzilla::DB::Schema::ABSTRACT_SCHEMA>.
$name - The name of the index that you want to drop.
Returns: nothing
+=item C<bz_drop_table($name)>
+
+ Description: Drops a table from the database. If the table
+ doesn't exist, we just return silently.
+ Params: $name - The name of the table to drop.
+ Returns: nothing
+
=item C<bz_alter_column($table, $name, \%new_def)>
Description: Changes the data type of a column in a table. Prints out