File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -609,15 +609,24 @@ public function maintenance(array $opts = []): mixed
609
609
610
610
/**
611
611
* @inheritdoc
612
+ * @noinspection SqlWithoutWhere
612
613
*/
613
614
public function reset (): bool
614
615
{
615
- $ this ->pdo ->exec ( ' DELETE FROM `state` WHERE `id` > 0 ' );
616
+ $ this ->pdo ->beginTransaction ( );
616
617
617
- if ('sqlite ' === $ this ->pdo ->getAttribute (PDO ::ATTR_DRIVER_NAME )) {
618
- $ this ->pdo ->exec ('DELETE FROM sqlite_sequence WHERE name = "state" ' );
618
+ $ tables = $ this ->pdo ->query (
619
+ 'SELECT name FROM sqlite_master WHERE "type" = "table" AND "name" NOT LIKE "sqlite_%" '
620
+ );
621
+
622
+ foreach ($ tables ->fetchAll (PDO ::FETCH_COLUMN ) as $ table ) {
623
+ $ this ->pdo ->exec ('DELETE FROM " ' . $ table . '" ' );
624
+ $ this ->pdo ->exec ('DELETE FROM sqlite_sequence WHERE "name" = " ' . $ table . '" ' );
619
625
}
620
626
627
+ $ this ->pdo ->commit ();
628
+ $ this ->pdo ->exec ('VACUUM ' );
629
+
621
630
return true ;
622
631
}
623
632
You can’t perform that action at this time.
0 commit comments