Fix issue with restoring backups older than the last new DB table created.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-02-22 15:05:11 -06:00
parent 72cc75b8c6
commit 5f63db9cae
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
1 changed files with 5 additions and 0 deletions

View File

@ -80,9 +80,14 @@ class RestoreCommand extends CommandAbstract
return 1;
}
// Drop all preloaded tables prior to running a DB dump backup.
$conn = $em->getConnection();
$connParams = $conn->getParams();
foreach ($conn->fetchFirstColumn('SHOW TABLES') as $table) {
$conn->executeQuery('DROP TABLE ' . $conn->quoteIdentifier($table));
}
$this->passThruProcess(
$io,
'mysql --host=$DB_HOST --user=$DB_USERNAME --password=$DB_PASSWORD $DB_DATABASE < $DB_DUMP',