问题
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 ?
回答1:
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
回答2:
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
回答3:
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
来源:https://stackoverflow.com/questions/15721151/unknown-database-type-tsvector-requested