教义迁移,使用自定义教义类型的问题

编程入门 行业动态 更新时间:2024-10-18 01:33:16
本文介绍了教义迁移,使用自定义教义类型的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用Symfony2 + Doctrine2构建应用程序。我的应用程序需要存储地理空间数据,所以我写了适当的原则扩展。所有的工作都很好,应用程序已经在生产环境中运行了很长时间。

现在我必须添加一些新功能,我需要更新数据库而不删除所有的数据。我想了解使用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:status

I 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\PointType

The 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

更多推荐

教义迁移,使用自定义教义类型的问题

本文发布于:2023-07-17 03:22:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128937.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:教义   自定义   类型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!