Update the db reset to include all tables not just the state.
This commit is contained in:
@@ -609,15 +609,24 @@ final class PDOAdapter implements iDB
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
* @noinspection SqlWithoutWhere
|
||||||
*/
|
*/
|
||||||
public function reset(): bool
|
public function reset(): bool
|
||||||
{
|
{
|
||||||
$this->pdo->exec('DELETE FROM `state` WHERE `id` > 0');
|
$this->pdo->beginTransaction();
|
||||||
|
|
||||||
if ('sqlite' === $this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) {
|
$tables = $this->pdo->query(
|
||||||
$this->pdo->exec('DELETE FROM sqlite_sequence WHERE name = "state"');
|
'SELECT name FROM sqlite_master WHERE "type" = "table" AND "name" NOT LIKE "sqlite_%"'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($tables->fetchAll(PDO::FETCH_COLUMN) as $table) {
|
||||||
|
$this->pdo->exec('DELETE FROM "' . $table . '"');
|
||||||
|
$this->pdo->exec('DELETE FROM sqlite_sequence WHERE "name" = "' . $table . '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->pdo->commit();
|
||||||
|
$this->pdo->exec('VACUUM');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user