Wizard Wizard - 6 months ago 7x
PHP Question

Symfony2 doctrine update schema from specific entity

If I run

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

I will update my database from all entities.

I need update database only for User entity, what is solution ?

One of solution is define custom entity manager and when pass thay entity manager to

php app/console doctrine:schema:update --force --em="custom"

But maybe exisgts something faster without definig custom entity manager ?


According to the command documentation, there is no such option. If this is something you have to do only once, I'd suggest to use the --dump-sql option to get the required SQL instructions, and manually run the ones you need.

P.S. I fail to understand what's the reason to only update the schema for an entity, and leave all the rest of entities not sync'd with the database. That sounds like a recipe for getting db errors.