theofidry / AliceDataFixtures

Nelmio Alice extension to persist the loaded fixtures.
MIT License
311 stars 71 forks source link

Is it possible to set the order of clearing tables in the database? #171

Closed nickicool closed 2 years ago

nickicool commented 3 years ago

Hi!

Adding fixtures is performed without problems - the script itself determines the structure of dependencies, and adds the necessary entities in the right order. It is a magic!!!

But the purging database doesn't go so well. Depending on the existing data in database, sometimes I got errors like:

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails ( vita-master.pricelists, CONSTRAINT FK_28511D04C4663E4 FOREIGN KEY (page_id) REFERENCES pages (id))

Is it possible to set the order of clearing tables in the database?

theofidry commented 3 years ago

This is curious because the FK checks should be disabled while purging: https://github.com/theofidry/AliceDataFixtures/blob/master/src/Bridge/Doctrine/Purger/Purger.php#L98

chasovskih-grisha commented 3 years ago

the same issue...

theofidry commented 3 years ago

Sorry I cannot help without reproducers. But otherwise no there is no way, the purgers are directly from https://github.com/doctrine/DoctrineFixturesBundle

theofidry commented 2 years ago

I suspect this is fixed by #194. Please feel free to open a new issue with a reproducer otherwise