Skip to content

Commit 5932a8e

Browse files
authored
Fix reset sqlite database
1 parent a506e24 commit 5932a8e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Database/SqliteDatabase.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ public function dropDatabase()
1919
{
2020
$iterator = $this->getDbDriver()->getIterator("
2121
select
22-
'drop table ' || name || ';' as command
22+
'drop ' || type || ' ' || name || ';' as command
2323
from sqlite_master
24-
where type = 'table'
25-
and name <> 'sqlite_sequence';
24+
where name <> 'sqlite_sequence'
25+
order by CASE type
26+
WHEN 'index' THEN 0
27+
WHEN 'trigger' THEN 1
28+
WHEN 'view' THEN 2
29+
ELSE 99
30+
END;
2631
");
2732

2833
foreach ($iterator as $row) {

0 commit comments

Comments
 (0)