laravel/framework · error · LogicException
This database driver does not support dropping all views.
Error message
This database driver does not support dropping all views.
What it means
Base Builder::dropAllViews() throws LogicException because the connected driver's SchemaBuilder does not override it. Only drivers that expose view catalogues (e.g. Postgres, SQL Server, MySQL) implement it; SQLite and incomplete custom drivers do not. It is a declared capability gap.
Source
Thrown at src/Illuminate/Database/Schema/Builder.php:588
* @return void
*
* @throws \LogicException
*/
public function dropAllTables()
{
throw new LogicException('This database driver does not support dropping all tables.');
}
/**
* Drop all views from the database.
*
* @return void
*
* @throws \LogicException
*/
public function dropAllViews()
{
throw new LogicException('This database driver does not support dropping all views.');
}
/**
* Drop all types from the database.
*
* @return void
*
* @throws \LogicException
*/
public function dropAllTypes()
{
throw new LogicException('This database driver does not support dropping all types.');
}
/**
* Rename a table on the schema.
*
* @param string $fromView on GitHub (pinned to bd6b5437e6)
Solutions
- Use a driver that implements dropAllViews (pgsql, mysql, sqlsrv).
- If using SQLite, drop individual views with DB::statement('DROP VIEW IF EXISTS name').
- Implement dropAllViews() on your custom Builder subclass.
Example fix
// before
Schema::dropAllViews();
// after (SQLite or unsupported driver)
foreach (DB::select("SELECT name FROM sqlite_master WHERE type='view'") as $v) {
DB::statement('DROP VIEW IF EXISTS '.$v->name);
} Defensive patterns
Strategy: type-guard
Validate before calling
$builder = Schema::getConnection()->getSchemaBuilder();
if ((new \ReflectionMethod($builder, 'dropAllViews'))->getDeclaringClass()->getName()
=== \Illuminate\Database\Schema\Builder::class) {
// unsupported — skip or fall back
} Type guard
function driverSupportsDropAllViews(): bool
{
$builder = Schema::getConnection()->getSchemaBuilder();
return (new \ReflectionMethod($builder, 'dropAllViews'))
->getDeclaringClass()->getName() !== \Illuminate\Database\Schema\Builder::class;
} Try / catch
try {
Schema::dropAllViews();
} catch (\LogicException $e) {
// unsupported driver — skip silently or surface
} Prevention
- Guard dropAllViews() by driver in shared test base classes.
- Use Postgres/MySQL/SQL Server when view teardown is required.
- Drop individual views with DB::statement('DROP VIEW IF EXISTS ...') on unsupported drivers.
When it happens
Trigger: Calling Schema::dropAllViews() or a test/maintenance script that clears views, while connected through a driver whose builder lacks the override (notably SQLite or a third-party driver).
Common situations: Running migrate:fresh -- --views on SQLite; pointing a test suite at SQLite while the migration path tries to drop views; a custom driver missing the method.
Related errors
- This database driver does not support retrieving views.
- This database driver does not support dropping all tables.
- This database driver does not support dropping all types.
- Extensions are only supported by Postgres.
- This database driver does not support retrieving schemas.
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/c453b0ffca39bb12.json.
Report an issue: GitHub.