我正在尝试向Doctrine中的枚举列添加自定义类型类,就像在https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/mysql-enums.html#solution-2-defining-a-type中一样 在我的模式/注释中可以正确识别此类型,但是如果它在数据库中实际使用,则会中断。
也就是说,如果列的类型不同(例如,ALTER TABLE `reservation` CHANGE `city_tax_travel_reason` `city_tax_travel_reason` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
之后),则架构工具将起作用:
user@srv3:~/portal/bin/app$ ./doctrine orm:schema-tool:update --dump-sql
The following SQL statements will be executed:
ALTER TABLE reservation CHANGE city_tax_travel_reason city_tax_travel_reason ENUM('business', 'leisure') NOT NULL COMMENT '(DC2Type:enumtravelreason)';
如果我这样做,下一个调用将带回我尝试使用此类解决的可怕的无效类型枚举错误:
user@srv3:~/portal/bin/app$ ./doctrine orm:schema-tool:update --dump-sql --force
The following SQL statements will be executed:
ALTER TABLE reservation CHANGE city_tax_travel_reason city_tax_travel_reason ENUM('business', 'leisure') NOT NULL COMMENT '(DC2Type:enumtravelreason)';
Updating database schema...
1 query was executed
[OK] Database schema updated successfully!
user@srv3:~/portal/bin/app$ ./doctrine orm:schema-tool:update --dump-sql
In AbstractPlatform.php line 434:
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
orm:schema-tool:update [--complete] [--dump-sql] [-f|--force]
user@srv3:~/portal/bin/app$
我想念什么吗?