现在我必须添加一些新功能,我需要更新数据库而不删除所有的数据。我想了解使用DoctrineMigrationBundle,但是当我运行时:
$ php app / console doctrine:migrations:status我收到此错误:
[Doctrine\DBAL\DBALException] 未知的数据库类型请求点, Doctrine\DBAL\Platforms\MySqlPlatform可能不支持。这是我config.yml的相关部分:
#Doctrine配置 doctrine: dbal:驱动程序:%database_driver%主机:%database_host% port:%database_port% dbname:%database_name%用户:%database_user%密码:%database_password%字符集:UTF8 类型:点:App \EngineBundle\DoctrineExtensions\PointType自定义类型点已被映射那么我做错了什么?
解决方案我回答自己的问题,似乎问题是DoctrineMigrations还需要一个映射自定义类型。所以config.yml应该如下所示:
#Doctrine Configuration doctrine: dbal:驱动程序:%database_driver%主机:%database_host%端口:%database_port% dbname:%database_name%用户:%database_user%密码: %database_password%字符集:UTF8 类型:点:App \EngineBundle\DoctrineExtensions\PointType mapping_types:点:点
I'm building a application using Symfony2 + Doctrine2. My application needs to store geospatial data, so I wrote the proper doctrine extensions. All is working pretty good and the app have been running in a production enviroment for a long time.
Now I have to add some new features and I need to update the database without deleting all the data. I thougth about using the DoctrineMigrationBundle but when I run:
$ php app/console doctrine:migrations:statusI got this error:
[Doctrine\DBAL\DBALException] Unknown database type point requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.This is the relevant section of my config.yml:
# Doctrine Configuration doctrine: dbal: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password% charset: UTF8 types: point: App\EngineBundle\DoctrineExtensions\PointTypeThe custom type 'point' has been mapped, so what am I doing wrong?
解决方案I answer my own question, it seems the problem is DoctrineMigrations also needs a mapping for the custom type. So the config.yml should look like this:
# Doctrine Configuration doctrine: dbal: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password% charset: UTF8 types: point: App\EngineBundle\DoctrineExtensions\PointType mapping_types: point: point
更多推荐
教义迁移,使用自定义教义类型的问题
发布评论