Reputation: 232
Hi i am just getting error when i tried to update doctrine scheme in my Symphony App. I run
php app/console doctrine:schema:update --force
and getting error this error
[Doctrine\DBAL\DBALException]
Unknown column type "mystoragetype" requested.
Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType().
You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypeMap().
If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type.
Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes().
If the type name is empty you might have a problem with the cache or forgot some mapping information.
I couldn't find anything related to "mystoragetype" in my project and also tried to add type but nothing happened. Could you figure it out why i am getting this error?
Upvotes: 4
Views: 5996
Reputation: 2317
Add to your migration only the raw SQL query that will delete the colum comments, e.g.
$this->addSql('ALTER TABLE some_table CHANGE COLUMN problematic_column problematic_column COLUMN_TYPE AFTER some_other_column');
Or if you want to get rid of the whole table (if you don't need it anymore):
$this->addSql('DROP TABLE some_table');
Doctrine is loading schema lazily. If you will not use any of the schema methods (e.g. $schema->dropTable
) inside migrations, Doctrine will not check the schema and will not find out that there is some problem with missing type.
Upvotes: 0
Reputation: 767
Doctrine adds comments to fields with custom type: Something like:(DC2Type:mystoragetype). I think you generated schema with that type and had to remove type from entity. But comment remains in database.
Upvotes: 6