I have a symfony project (2.8 version) that run the following bundles :
This website is linked with a mySQL database (version 5.6).
I had issues with doctrine when I want to update my database scheme with the following command :
php app/console doctrine:schema:update --force
Because the varchar(255)type was not supported by innoDB engine and my database so I decreased all varchar to 191 length and now it's working.
My issue now is that doctrine want to generate tables (linked with acl apparently) that I cannot control like the following :
CREATE TABLE acl_classes (id INT UNSIGNED AUTO_INCREMENT NOT NULL, class_type VARCHAR(200) NOT NULL, UNIQUE INDEX UNIQ_69DD750638A36066 (class_type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB;
How can I decrease the length of class_type to apply varchar(191) ?
Thank you by advance.
答案 0 :(得分:1)
您可以在/vendor/symfony/security-acl/Dbal/Schema.php第70行https://github.com/symfony/security-acl/blob/master/Dbal/Schema.php#L70
中进行修复$table->addColumn('class_type', 'string', array('length' => 200));
更改为
$table->addColumn('class_type', 'string', array('length' => 190));
或者您可以尝试utf8mb4
编码:
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci