laravel/framework · error · 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 mass-dropping is inherently driver-specific. Only MySqlBuilder, SQLiteBuilder, PostgresBuilder, and SqlServerBuilder override it; the base implementation is a deliberate stub signalling 'your driver did not implement this'. It is a programming/configuration error, not a runtime data condition - the connection's Schema\Builder class is the wrong type for the call.

Solutions

  1. Switch to a connection whose driver implements dropAllTables (mysql, sqlite, pgsql, sqlsrv) for the migrate:fresh workflow.
  2. If you maintain the driver, override dropAllTables() in your driver's Builder with the engine-appropriate truncation/DROP statement.
  3. Replace migrate:fresh with migrate:rollback / migrate:refresh, which do not call dropAllTables.
  4. Drop tables explicitly with Schema::drop() per table instead of the bulk operation.

Example fix

// before (throws on a driver without dropAllTables)
Schema::connection('clickhouse')->dropAllTables();

// after - drop the specific tables you know about
foreach (['events', 'logs', 'metrics'] as $t) {
    Schema::connection('clickhouse')->dropIfExists($t);
}
Defensive patterns

Strategy: type-guard

Validate before calling

$builder = Schema::connection($name)->getConnection()->getSchemaBuilder();
if ((new \ReflectionMethod($builder, 'dropAllTables'))->getDeclaringClass()->getName() === \Illuminate\Database\Schema\Builder::class) {
    throw new \DomainException("Connection '{$name}' does not support dropAllTables; skipping.");
}
$builder->dropAllTables();

Type guard

function supportsDropAllTables(\Illuminate\Database\Schema\Builder $builder): bool
{
    return (new \ReflectionMethod($builder, 'dropAllTables'))
        ->getDeclaringClass()->getName() !== \Illuminate\Database\Schema\Builder::class;
}

Try / catch

try {
    Schema::dropAllTables();
} catch (\LogicException $e) {
    // expected on drivers without a dropAllTables override; fall back to per-table drops
    foreach (Schema::getTableListing() as $table) {
        Schema::drop($table);
    }
}

Prevention

When it happens

Trigger: Invoking Schema::getConnection()->getSchemaBuilder()->dropAllTables() on a connection whose Builder is the base Illuminate\Database\Schema\Builder (a custom or third-party driver that subclassed Builder without overriding dropAllTables). Also reached transitively by php artisan migrate:fresh, which calls dropAllTables() before re-running migrations.

Common situations: Using a community driver (e.g. a clickhouse, mongodb, or duckdb bridge) whose Builder extends the base class but never implemented dropAllTables; running migrate:fresh in CI against such a driver; a test that wires a generic Builder onto a Connection for mocking.

Related errors


AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11). Data as JSON: /api/errors/9b1031d54dfd0696. Report an issue: GitHub.

Appendix: 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 void

View on GitHub (pinned to e0f6eb3518)