Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
f18c6f0b
Commit
f18c6f0b
authored
Apr 17, 2005
by
mkanat%kerio.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 290411: Cross-DB bz_drop_table
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=Tomas.Kopal, a=justdave
parent
8231d98d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
DB.pm
Bugzilla/DB.pm
+23
-0
Schema.pm
Bugzilla/DB/Schema.pm
+30
-1
No files found.
Bugzilla/DB.pm
View file @
f18c6f0b
...
...
@@ -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
...
...
Bugzilla/DB/Schema.pm
View file @
f18c6f0b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment