Issue #3145412 by pavnish, cburschka, amateescu: Connection::__destruct() can't delete the sqlite file

merge-requests/2/head
catch 2020-06-29 16:16:28 +01:00
parent 1a48485ede
commit 0073e14852
1 changed files with 3 additions and 3 deletions

View File

@ -187,9 +187,9 @@ class Connection extends DatabaseConnection {
// We can prune the database file if it doesn't have any tables.
if ($count == 0 && $this->connectionOptions['database'] != ':memory:' && file_exists($this->connectionOptions['database'] . '-' . $prefix)) {
// Detaching the database fails at this point, but no other queries
// are executed after the connection is destructed so we can simply
// remove the database file.
// Detach the database.
$this->query('DETACH DATABASE :schema', [':schema' => $prefix]);
// Destroy the database file.
unlink($this->connectionOptions['database'] . '-' . $prefix);
}
}