Skip to content

Commit

Permalink
Merge pull request #40 from byjg/patch-sqlite
Browse files Browse the repository at this point in the history
Fix reset sqlite database
  • Loading branch information
byjg authored Mar 6, 2022
2 parents a506e24 + 5932a8e commit 902f0ac
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Database/SqliteDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ public function dropDatabase()
{
$iterator = $this->getDbDriver()->getIterator("
select
'drop table ' || name || ';' as command
'drop ' || type || ' ' || name || ';' as command
from sqlite_master
where type = 'table'
and name <> 'sqlite_sequence';
where name <> 'sqlite_sequence'
order by CASE type
WHEN 'index' THEN 0
WHEN 'trigger' THEN 1
WHEN 'view' THEN 2
ELSE 99
END;
");

foreach ($iterator as $row) {
Expand Down

0 comments on commit 902f0ac

Please sign in to comment.