doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.77k stars 224 forks source link

Disable foreign key checks on purge for all MySQL versions #272

Open robertfausk opened 6 years ago

robertfausk commented 6 years ago

... when purge mode is truncate


As statet in https://github.com/doctrine/dbal/pull/2620 doctrine/dbal is not responsible for this ("third party code has to built its own implementation around this because it is highly use-case specific"). So I give it a try to finish this long term never ending story.

Closes (stale?) PR #127 and fixes #113.

robertfausk commented 6 years ago

Määähhh. Build currently fails because of pecl installation of mongodb. Also see #271.

At least nightly passed :hushed:

theofidry commented 6 years ago

@ocramius I know we already talked about that and at that time you were not in favour of that choice.

Maybe you changed your opinion since then, but I still think this should be done here. We are in the context of fixtures were truncating/deleting some tables doesn't make sense for the application.

We can always argue that the user can do that on his side (and that's what they end up doing), but it's silly to push that extra step to the user when 90% if not more needs it and the other 10% probably don't care.

On the same token, a recurrent request is to not truncate read-only tables. I have more mixed feeling about this but maybe this is actually a good idea and should be handled by the purger as well.

jopais commented 4 years ago

I think this is an important change. Can you look at it again?

ilya-realforce commented 4 years ago

Any update on this? I think it's straight-up ORMPurger's responsibility to purge DB even if there're foreign keys.