Skip to content


DBAL-166: Table Encoding on generation table creation query #1324

doctrinebot opened this Issue · 4 comments

2 participants


Jira issue originally created by user png-tech:

Can not set charset options for table creation.
Now I am fix thix problem in patch.
File: doctrine-dbal/lib/Doctrine/DBAL/Schema/Schema.php


  • Doctrine DBAL Patch
  • fix table creation query encode
  • (c) _Nicolay */ system ('cp ./vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/Schema.php ./vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/Schema.php.Orig');

$data = filegetcontents('./vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/Schema.php');
$data = str_replace("new Table(\$tableName);",
"new Table(\$tableName,array(),array(),array(),0,array('charset'=>'utf8','collate'=>'utf8generalci'));",
fileputcontents('./vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/Schema.php', $data);


Comment created by stfalcon:

Guys, it's real problem for me too! (:

My test suite (in symfony2 project) always creates tables with "latin1swedish_ci" collation. I want set "utf8_generalci". But I don't want do it's in mysql.ini.

I tried setting it in MysqlSessionInit **construct, but it's not solved my problem.

In MySqlPlatform I found next code (

        if (isset($options['charset'])) {
            $optionStrings['charset'] = 'DEFAULT CHARACTER SET ' . $options['charset'];
            if (isset($options['collate'])) {
                $optionStrings['charset'] .= ' COLLATE ' . $options['collate'];

But any options don't set in this call


Comment created by @beberlei:

Implemented this as a new feature on Schema. Also defaulting to UTF-8 now.


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.3 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.