symfony/DoctrineFixturesBundle — Issue #17: [Purge] Purging not working correctly with MySQL.
Author: makasim
Created: 2011-10-26 09:57:04+00:00
State: open

I am using MySql and InnoDB engine. Doctrine generates tables with foreign keys.

While purging a database I am getting the error:

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`jobly`.`message`, CONSTRAINT `FK_B6BD307F8829462F` FOREIGN KEY (`message_thread_id`) REFERENCES `message_thread` (`id`))

That can be avoided by adding `SET foreign_key_checks = 0;` somewhere.
or there should be a way to inject your own purger to command (like ORMMysqlPurger).

I would really do a PR with the fix but I want to know your thoughts about the best way to handle it.