本文介绍了请求了未知的数据库类型tsvector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我的问题是我在表中添加了tsvector类型的列,而没有在实体类中添加它,现在我想运行 doctrine:schema:update --force 它给了我这个错误

so my problem is that i added a column of type tsvector in a table without adding it in the entity class and now when i want to run doctrine:schema:update --force it gives me this error

Unknown database type tsvector requested, 
Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it.

我现在应该怎么做,我是否必须在原则中创建tsvector类型或删除tsvector列用命令行更新模式,然后在后面添加tsvector列?

what should i do now, do i have to create a tsvector type in doctrine or delete the tsvector column update the schema with the commande line and then add the tsvector column back ?

推荐答案

您应该始终注册您使用的任何类型,这是学说所不支持的,那是注册tsvector类型最明显的例子,然后在您的config.yml中添加以下内容:

you should always register any type the you use and that is not supported by doctrine, thats the most obvious example of registering tsvector type https://gist.github.com/darklow/3129096 and in your config.yml add this:

dbal:
    driver:   %database_driver%
    host:     %database_host%
    port:     %database_port%
    dbname:   %database_name%
    user:     %database_user%
    password: %database_password%
    charset:  UTF8
    types:
        tsvector:
            class: myProject\myBundle\Type\tsvectorType
    mapping_types:
        tsvector: tsvector

这篇关于请求了未知的数据库类型tsvector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 03:25