Is it possible to run the task “symfony doctrine b

2019-02-19 17:21发布

问题:

If I run the folowing task, it builds everything and wipes out the database:

php symfony doctrine build --all

I would like this task to run only for the new table that I've put in schema.yml

Is it possible ?

回答1:

I think you should use migration for that.

First, you need to restore the initial state (when schema, model and db are in sync). Remove your changes form schema.yml rebuild your model php symfony doctrine:build --all-classes and import the original database.

After that make your changes in schema.yml and run these commands:

php symfony doctrine:generate-migrations-diff
php symfony doctrine:migrate
php symfony doctrine:build --all-classes