Issue #3145412 by pavnish, cburschka, amateescu: Connection::__destruct() can't delete the sqlite file
parent
1a48485ede
commit
0073e14852
|
@ -187,9 +187,9 @@ class Connection extends DatabaseConnection {
|
||||||
|
|
||||||
// We can prune the database file if it doesn't have any tables.
|
// 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)) {
|
if ($count == 0 && $this->connectionOptions['database'] != ':memory:' && file_exists($this->connectionOptions['database'] . '-' . $prefix)) {
|
||||||
// Detaching the database fails at this point, but no other queries
|
// Detach the database.
|
||||||
// are executed after the connection is destructed so we can simply
|
$this->query('DETACH DATABASE :schema', [':schema' => $prefix]);
|
||||||
// remove the database file.
|
// Destroy the database file.
|
||||||
unlink($this->connectionOptions['database'] . '-' . $prefix);
|
unlink($this->connectionOptions['database'] . '-' . $prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue