laravel/framework · critical · LogicException
This database driver does not support dropping all tables.
Error message
This database driver does not support dropping all tables.
What it means
The base Schema\Builder::dropAllTables() throws a LogicException because the driver in use did not override it. Each concrete builder (MySqlBuilder, PostgresBuilder, SQLiteBuilder, SqlServerBuilder) that supports the operation overrides this method; any driver whose builder lacks the override will hit the base implementation. This is a hard capability gap, not a transient failure.
Source
Thrown at src/Illuminate/Database/Schema/Builder.php:576
* @return void
*/
public function dropColumns($table, $columns)
{
$this->table($table, function (Blueprint $blueprint) use ($columns) {
$blueprint->dropColumn($columns);
});
}
/**
* Drop all tables from the database.
*
* @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 voidView on GitHub (pinned to bd6b5437e6)
Solutions
- Switch the DB connection to a first-class driver (mysql, pgsql, sqlite, sqlsrv) whose builder overrides dropAllTables.
- If you maintain a custom driver, subclass Schema\Builder and implement dropAllTables() with the engine's native 'drop all' SQL.
- For tests, use SQLite in-memory (sqlite::memory:) which supports dropAllTables, instead of an unsupported engine.
- Avoid migrate:fresh on the unsupported connection; use migrate:rollback or individual Schema::drop() calls instead.
Example fix
// before — connection 'foo' uses a driver whose Builder does not override dropAllTables
Schema::connection('foo')->dropAllTables();
// after — implement on your custom builder
class FooBuilder extends \Illuminate\Database\Schema\Builder
{
public function dropAllTables(): void
{
$this->connection->statement('DROP TABLE ...'); // engine-specific
}
} Defensive patterns
Strategy: type-guard
Validate before calling
$builder = Schema::getConnection()->getSchemaBuilder();
if ((new \ReflectionMethod($builder, 'dropAllTables'))->getDeclaringClass()->getName()
=== \Illuminate\Database\Schema\Builder::class) {
throw new \RuntimeException('dropAllTables not supported by driver '.DB::connection()->getDriverName());
} Type guard
function driverSupportsDropAllTables(): bool
{
$builder = Schema::getConnection()->getSchemaBuilder();
return (new \ReflectionMethod($builder, 'dropAllTables'))
->getDeclaringClass()->getName() !== \Illuminate\Database\Schema\Builder::class;
} Try / catch
try {
Schema::dropAllTables();
} catch (\LogicException $e) {
// driver lacks support — surface to caller, do not silently continue
throw $e;
} Prevention
- Only run migrate:fresh / dropAllTables on first-class drivers.
- Pin test DB to sqlite::memory: or a real mysql/pgsql instance.
- Implement the method on any custom Schema\Builder subclass.
- Guard with driver type before invoking in shared code.
When it happens
Trigger: Calling Schema::dropAllTables(), Artisan migrate:fresh, or any code path that invokes it (e.g. testing teardown / RefreshDatabase / DatabaseMigrations trait with an unsupported driver) while connected through a Connection whose SchemaBuilder is the base or an incomplete subclass.
Common situations: Wiring a custom/obscure PDO driver that extends Connection but does not provide a SchemaBuilder subclass with dropAllTables; pointing a test suite at a DB engine whose driver lacks the override; using a community driver package that is incomplete against the Laravel version in use.
Related errors
- This database driver does not support dropping all views.
- This database driver does not support dropping all types.
- Extensions are only supported by Postgres.
- This database driver does not support retrieving schemas.
- This database driver does not support retrieving tables.
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/9b1031d54dfd0696.json.
Report an issue: GitHub.