Disable FK checks when restoring backups.
This commit is contained in:
parent
5f63db9cae
commit
4cd090decd
|
@ -80,13 +80,15 @@ class RestoreCommand extends CommandAbstract
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Drop all preloaded tables prior to running a DB dump backup.
|
||||
$conn = $em->getConnection();
|
||||
$connParams = $conn->getParams();
|
||||
|
||||
// Drop all preloaded tables prior to running a DB dump backup.
|
||||
$conn->executeQuery('SET FOREIGN_KEY_CHECKS = 0');
|
||||
foreach ($conn->fetchFirstColumn('SHOW TABLES') as $table) {
|
||||
$conn->executeQuery('DROP TABLE ' . $conn->quoteIdentifier($table));
|
||||
$conn->executeQuery('DROP TABLE IF EXISTS ' . $conn->quoteIdentifier($table));
|
||||
}
|
||||
$conn->executeQuery('SET FOREIGN_KEY_CHECKS = 1');
|
||||
|
||||
$this->passThruProcess(
|
||||
$io,
|
||||
|
|
Loading…
Reference in a new issue