Unknown database type tsvector requested

2019-08-07 15:02发布

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.

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 ?

3条回答
走好不送
2楼-- · 2019-08-07 15:27

If you are not planning to use it with Doctrine you can just add the following to your doctrine config.

dbal:
    driver:   %database_driver%
    ...
    ...
    types:
        tsvector: string
        hstore: string
查看更多
啃猪蹄的小仙女
3楼-- · 2019-08-07 15:33

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
查看更多
Juvenile、少年°
4楼-- · 2019-08-07 15:43

Obviously doctrine abstraction layer doesn't know such type, so it can't make any use of such typed column, even if column is already defined in database table...

Consider registering new doctrine custom type. There is example of tsvector type implementation https://gist.github.com/darklow/3129096

查看更多
登录 后发表回答