]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
The original patch for bug 508186 actually broke utf-8 conversion--the tables were...
authormkanat%bugzilla.org <>
Fri, 7 Aug 2009 21:45:31 +0000 (21:45 +0000)
committermkanat%bugzilla.org <>
Fri, 7 Aug 2009 21:45:31 +0000 (21:45 +0000)
Bugzilla/DB/Mysql.pm

index 54659f5b0552cde9306b4268bb7bd66828b5fcd2..380448ba38c747561c376891a9c4beb70e8cf3c5 100644 (file)
@@ -748,6 +748,8 @@ EOT
                     # right after the type, which will always come first.
                     my ($binary, $utf8) = ($sql_def, $sql_def);
                     my $type = $self->_bz_schema->convert_type($col_info->{TYPE});
+                    $binary =~ s/(\Q$type\E)/$1 CHARACTER SET binary/;
+                    $utf8   =~ s/(\Q$type\E)/$1 CHARACTER SET utf8/;
                     push(@binary_sql, "MODIFY COLUMN $name $binary");
                     push(@utf8_sql, "MODIFY COLUMN $name $utf8");
                 }
@@ -767,7 +769,8 @@ EOT
 
                 print "Converting the $table table to UTF-8...\n";
                 my $bin = "ALTER TABLE $table " . join(', ', @binary_sql);
-                my $utf = "ALTER TABLE $table " . join(', ', @utf8_sql);
+                my $utf = "ALTER TABLE $table " . join(', ', @utf8_sql,
+                          'DEFAULT CHARACTER SET utf8');
                 $self->do($bin);
                 $self->do($utf);
 
@@ -776,8 +779,9 @@ EOT
                     $self->bz_add_index($table, $index, $indexes{$index});
                 }
             }
-
-            $self->do("ALTER TABLE $table DEFAULT CHARACTER SET utf8");
+            else {
+                $self->do("ALTER TABLE $table DEFAULT CHARACTER SET utf8");
+            }
 
         } # foreach my $table (@tables)