简体   繁体   中英

Doctrine create sql from entities but only for un-migrated changes?

I'm using the console command doctrine:schema:create --dump-sql to generate the SQL for a migration file.

I'm repeatedly running it as I'm making small changes to the entities during development (Entity first design, rather than SQL first) to keep my dev db schema up to date.

However that is generating the full schema and not just the entities that have been modified. Is there a way of only generated the SQL for the modified entities?

No luck with google search or doctrine:schema:create --help

I would suggest to use doctrine/migrations-bundle . With each change of your entities you can run:

bin/console doctrine:migrations:diff : This will show all the edits you made to your entities

Then run the following to update your database:

bin/console doctrine:migrations:migrate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM