Skip to content

Commit 3c5bdfd

Browse files
authored
Handle SQLite without ENABLE_DBSTAT_VTAB enabled. Fixes #44860 (#44867)
1 parent f14b34b commit 3c5bdfd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Illuminate/Database/Console/DatabaseInspectionCommand.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Database\ConnectionInterface;
88
use Illuminate\Database\MySqlConnection;
99
use Illuminate\Database\PostgresConnection;
10+
use Illuminate\Database\QueryException;
1011
use Illuminate\Database\SQLiteConnection;
1112
use Illuminate\Database\SqlServerConnection;
1213
use Illuminate\Support\Arr;
@@ -151,11 +152,15 @@ protected function getPostgresTableSize(ConnectionInterface $connection, string
151152
*/
152153
protected function getSqliteTableSize(ConnectionInterface $connection, string $table)
153154
{
154-
$result = $connection->selectOne('SELECT SUM(pgsize) AS size FROM dbstat WHERE name=?', [
155-
$table,
156-
]);
155+
try {
156+
$result = $connection->selectOne('SELECT SUM(pgsize) AS size FROM dbstat WHERE name=?', [
157+
$table,
158+
]);
157159

158-
return Arr::wrap((array) $result)['size'];
160+
return Arr::wrap((array) $result)['size'];
161+
} catch (QueryException $e) {
162+
return null;
163+
}
159164
}
160165

161166
/**

0 commit comments

Comments
 (0)