Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable FOREIGN_KEY_CHECKS when purging database #32

Merged

Conversation

alexislefebvre
Copy link
Collaborator

@alexislefebvre alexislefebvre commented Jul 22, 2019

When the parameter liip_test_fixtures.keep_database_and_schema: true is enabled, I have the following output:

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (truebadges.Badge, CONSTRAINT FK_3F316719F6BD1646 FOREIGN KEY (site_id) REFERENCES Site (id))

…/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:49
…/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:169
…/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:145
…/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1063
…/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures> /Purger/ORMPurger.php:132
…/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php:133
…/vendor/liip/test-fixtures-bundle/src/Services/DatabaseTools/ORMDatabaseTool.php:148
…/vendor/liip/test-fixtures-bundle/src/Test/FixturesTrait.php:87
…/tests/SEBundle/Command/CalculateSitesMinMaxCommandTest.php:33

This PR disables FOREIGN_KEY_CHECKS before purging the database.

@alexislefebvre alexislefebvre merged commit f0313e4 into master Jul 28, 2019
@alexislefebvre alexislefebvre deleted the disable-foreign-key-checks-when-purging-database branch July 28, 2019 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant