I created database on my local machine. After moving my project to server I imported backup from local (because I had some important data there).
Now,when I\'m trying t
If Doctrine schema updates fail because of foreign-key constraints, you simply need to disable foreign-key checks for this particular update.
As a one-liner you can run:
mysql -e "set foreign_key_checks = 0; `app/console doctrine:schema:update --dump-sql`"
This prepends set foreign_key_checks = 0;
to the output of app/console doctrine:schema:update --dump-sql
so it actually calls exactly what Doctrine would call but with foreign-key checks disabled. Configure the mysql
call to your needs.
Your schema is updated and depending on your changes no data is lost.
Keep in mind that sometimes the order of the queries is important and Doctrine simply didn't order them right. In this case you have to order the queries correctly by your own and then use that ordered list of queries instead.