diff --git a/bundles/InstallBundle/Installer.php b/bundles/InstallBundle/Installer.php index eed51743d19..6e8c8af6b4c 100644 --- a/bundles/InstallBundle/Installer.php +++ b/bundles/InstallBundle/Installer.php @@ -579,6 +579,9 @@ private function clearKernelCacheDir(KernelInterface $kernel) public function setupDatabase(array $userCredentials, array $errors = []): array { + $db = \Pimcore\Db::get(); + $db->query('SET FOREIGN_KEY_CHECKS=0;'); + if ($this->createDatabaseStructure) { $mysqlInstallScript = file_get_contents(__DIR__ . '/Resources/install.sql'); @@ -588,7 +591,6 @@ public function setupDatabase(array $userCredentials, array $errors = []): array // get every command as single part $mysqlInstallScripts = explode(';', $mysqlInstallScript); - $db = \Pimcore\Db::get(); // execute every script with a separate call, otherwise this will end in a PDO_Exception "unbufferd queries, ..." seems to be a PDO bug after some googling foreach ($mysqlInstallScripts as $m) { $sql = trim($m); @@ -627,6 +629,8 @@ public function setupDatabase(array $userCredentials, array $errors = []): array } } + $db->query('SET FOREIGN_KEY_CHECKS=1;'); + return $errors; }