[Rt-commit] rt branch, 4.0/mysql-charsets, created. rt-4.0.8-249-gb4aa9ab

Thomas Sibley trs at bestpractical.com
Fri Dec 14 13:49:16 EST 2012


The branch, 4.0/mysql-charsets has been created
        at  b4aa9ab8149422acceb8dd1d1c5dbf55ab94eb73 (commit)

- Log -----------------------------------------------------------------
commit b4aa9ab8149422acceb8dd1d1c5dbf55ab94eb73
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Dec 14 10:37:36 2012 -0800

    Create fresh MySQL databases with a default charset of UTF8
    
    MySQL databases upgraded from < 3.8.0 to >= 3.8.0 run an ALTER DATABASE
    command which sets the default character set to utf8 (via 947937e in
    upgrade-mysql-schema.pl).  Fresh databases never set a default, but
    always created tables as UTF8.  A consistent set of defaults between
    upgraded and fresh DBs will help prevent bugs in the future.
    
    Pointed out by Christian Loos in [rt3 #21773].

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 03c262b..46716b2 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -354,6 +354,9 @@ sub CreateDatabase {
     elsif ( $db_type eq 'Pg' ) {
         $status = $dbh->do("CREATE DATABASE $db_name WITH ENCODING='UNICODE' TEMPLATE template0");
     }
+    elsif ( $db_type eq 'mysql' ) {
+        $status = $dbh->do("CREATE DATABASE $db_name DEFAULT CHARACTER SET utf8");
+    }
     else {
         $status = $dbh->do("CREATE DATABASE $db_name");
     }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list