summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authorjustdave%bugzilla.org <>2007-04-15 08:35:56 +0200
committerjustdave%bugzilla.org <>2007-04-15 08:35:56 +0200
commit8da7f321aabe95470944bc23aeed9a06ef6793a5 (patch)
treeb16ca05abfae22dffd3ca8f0c868cc799273f2e7 /Bugzilla/DB.pm
parentb3630da125fa112e04f6e6a15328f64e13a874c5 (diff)
downloadbugzilla-8da7f321aabe95470944bc23aeed9a06ef6793a5.tar.gz
bugzilla-8da7f321aabe95470944bc23aeed9a06ef6793a5.tar.xz
Bug 373869: Custom field names must be all lowercase or buglist.cgi sorting throws an error
Patch by mkanat and justdave r=LpSolit,mkanat; a=mkanat
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm44
1 files changed, 43 insertions, 1 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index ffa3e96d1..c87ecbdf5 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -749,7 +749,7 @@ sub bz_rename_column {
if ($old_col_exists) {
my $already_renamed = $self->bz_column_info($table, $new_name);
- ThrowCodeError('column_rename_conflict',
+ ThrowCodeError('db_rename_conflict',
{ old => "$table.$old_name",
new => "$table.$new_name" }) if $already_renamed;
my @statements = $self->_bz_real_schema->get_rename_column_ddl(
@@ -767,6 +767,23 @@ sub bz_rename_column {
}
}
+sub bz_rename_table {
+ my ($self, $old_name, $new_name) = @_;
+ my $old_table = $self->bz_table_info($old_name);
+ return if !$old_table;
+
+ my $new = $self->bz_table_info($new_name);
+ ThrowCodeError('db_rename_conflict', { old => $old_name,
+ new => $new_name }) if $new;
+ my @sql = $self->_bz_real_schema->get_rename_table_sql($old_name, $new_name);
+ print get_text('install_table_rename',
+ { old => $old_name, new => $new_name }) . "\n"
+ if Bugzilla->usage_mode == USAGE_MODE_CMDLINE;
+ $self->do($_) foreach @sql;
+ $self->_bz_real_schema->rename_table($old_name, $new_name);
+ $self->_bz_store_real_schema;
+}
+
#####################################################################
# Schema Information Methods
#####################################################################
@@ -2155,6 +2172,31 @@ that you want to rename
=back
+=item C<bz_rename_table>
+
+=over
+
+=item B<Description>
+
+Renames a table in the database. Does nothing if the table doesn't exist.
+
+Throws an error if the old table exists and there is already a table
+with the new name.
+
+=item B<Params>
+
+=over
+
+=item C<$old_name> - The current name of the table.
+
+=item C<$new_name> - What you're renaming the table to.
+
+=back
+
+=item B<Returns> (nothing)
+
+=back
+
=back
=head2 Schema Information Methods