aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authorjustdave%bugzilla.org <>2007-04-15 06:35:56 +0000
committerjustdave%bugzilla.org <>2007-04-15 06:35:56 +0000
commit8da7f321aabe95470944bc23aeed9a06ef6793a5 (patch)
treeb16ca05abfae22dffd3ca8f0c868cc799273f2e7 /Bugzilla/Install
parentb3630da125fa112e04f6e6a15328f64e13a874c5 (diff)
downloadbugs-8da7f321aabe95470944bc23aeed9a06ef6793a5.tar
bugs-8da7f321aabe95470944bc23aeed9a06ef6793a5.tar.gz
bugs-8da7f321aabe95470944bc23aeed9a06ef6793a5.tar.bz2
bugs-8da7f321aabe95470944bc23aeed9a06ef6793a5.tar.xz
bugs-8da7f321aabe95470944bc23aeed9a06ef6793a5.zip
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/Install')
-rw-r--r--Bugzilla/Install/DB.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 96bc161ac..f05f1722e 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -503,6 +503,8 @@ sub update_table_definitions {
$dbh->bz_add_column('milestones', 'id',
{TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
+ _fix_uppercase_custom_field_names();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -2732,6 +2734,25 @@ sub _update_longdescs_who_index {
}
}
+sub _fix_uppercase_custom_field_names {
+ # Before the final release of 3.0, custom fields could be
+ # created with mixed-case names.
+ my $dbh = Bugzilla->dbh;
+ my $fields = $dbh->selectall_arrayref(
+ 'SELECT name, type FROM fielddefs WHERE custom = 1');
+ foreach my $row (@$fields) {
+ my ($name, $type) = @$row;
+ if ($name ne lc($name)) {
+ $dbh->bz_rename_column('bugs', $name, lc($name));
+ $dbh->bz_rename_table($name, lc($name))
+ if $type == FIELD_TYPE_SINGLE_SELECT;
+ $dbh->do('UPDATE fielddefs SET name = ? WHERE name = ?',
+ undef, lc($name), $name);
+ }
+ }
+
+}
+
1;
__END__