Skip to content

Commit

Permalink
CoreInstaller.php: FOREIGN_KEY_CHECKS=0 to drop all tables
Browse files Browse the repository at this point in the history
Answering "yes" to "Continue?" just throw errors and fail.

  SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
  • Loading branch information
adriendupuis committed Feb 20, 2025
1 parent 069cb64 commit 7c87e0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bundle/RepositoryInstaller/Installer/CoreInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected function getDropSqlStatementsForExistingSchema(
AbstractPlatform $databasePlatform
): array {
$existingSchema = $this->db->getSchemaManager()->createSchema();
$statements = [];
$statements = ['SET FOREIGN_KEY_CHECKS=0'];
// reverse table order for clean-up (due to FKs)
$tables = array_reverse($newSchema->getTables());
// cleanup pre-existing database
Expand Down

0 comments on commit 7c87e0f

Please sign in to comment.