diff options
author | mkanat%kerio.com <> | 2005-04-17 16:27:06 +0200 |
---|---|---|
committer | mkanat%kerio.com <> | 2005-04-17 16:27:06 +0200 |
commit | f18c6f0b18359a7b3e525bf398f51ccb1773c86f (patch) | |
tree | 4e68ca33956297dfced2e0a2b4183cb0369d067f /Bugzilla/DB | |
parent | 8231d98d0644c387ea8476f61b4a3301848403d9 (diff) | |
download | bugzilla-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')
-rw-r--r-- | Bugzilla/DB/Schema.pm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index c65d1f0f2..8dce761d8 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -1549,6 +1549,18 @@ sub get_drop_column_ddl { return ("ALTER TABLE $table DROP COLUMN $column"); } +=item C<get_drop_table_ddl($table)> + + Description: Generate SQL to drop a table from the database. + Params: $table - The name of the table to drop. + Returns: An array of SQL statements. + +=cut +sub get_drop_table_ddl { + my ($self, $table) = @_; + return ("DROP TABLE $table"); +} + sub get_rename_column_ddl { =item C<get_rename_column_ddl($table, $old_name, $new_name)> @@ -1568,11 +1580,28 @@ sub get_rename_column_ddl { . " has not implemented a method."; } +=item C<delete_table($name)> + + Description: Deletes a table from this Schema object. + Dies if you try to delete a table that doesn't exist. + Params: $name - The name of the table to delete. + Returns: nothing + +=cut +sub delete_table { + my ($self, $name) = @_; + + die "Attempted to delete nonexistent table '$name'." unless + $self->get_table_abstract($name); + + delete $self->{abstract_schema}->{$name}; + delete $self->{schema}->{$name}; +} + sub get_column_abstract { =item C<get_column_abstract($table, $column)> - Description: A column definition from the abstract internal schema. cross-database format. Params: $table - The name of the table |