summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install/DB.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Install/DB.pm')
-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__