FIXED: Doctrine 2 Unknown database type enum requested

Unknown database type enum requested

While working on ACARateQuote.com I came across an issue using symfony2’s doctrine schema update command from the terminal.

Here’s the command

php app/console doctrine:schema:update --force -vv

Here’s the error:


[Doctrine\DBAL\DBALException]
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.

The issue is that Doctrine inspects all the tables in the database, even if those tables are not currently mapped to any entities, and that Doctrine does not natively support MySQL’s ENUM column type. In my case, I had a table created with raw data that had not been fully normalized and contained several ENUM columns.

The quickest solution to this problem, is to update your app/config/config.yml to map the ENUM column type to a string column type. The highlighted lines below show the change.

Once you make the update to your config.yml you should be able to execute the console command again without any issues.

Posted October 29th, 2013 in Uncategorized. Tagged: , , , , .

4 comments:

  1. ABonus:

    Hey John,

    Thanks a lot for the details, we had the problem with a non-related table to schema which was containing ENUMs. We didn’t know that DOCTRINE was inspecting EVERY tables (even if those tables are not currently mapped to any entities). After removing ENUM tables there was no error left.

    Anyways, thanks a lot.
    Regards

  2. tomrice:

    Thanks for your comment ABonus, it just saved me! Was sat here wondering why I couldn’t update Concrete5 to Concrete5.7.3.1 and it was exactly the same issue.

  3. Nick:

    Thank you so much!!

  4. Evaldo:

    Thanks a lot. Works perfectly.

Leave a response:

*