laravel/framework · error · LogicException

This database driver does not support dropping all types.

Error message

This database driver does not support dropping all types.

What it means

Base Builder::dropAllTypes() throws LogicException when the driver's SchemaBuilder has not overridden it. User-defined types (ENUM, composite, domain) are essentially a Postgres concept; this method exists so PostgresBuilder can drop enum/composite types during fresh migrations. Other drivers intentionally leave it unimplemented.

Source

Thrown at src/Illuminate/Database/Schema/Builder.php:600

     * @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  $from
     * @param  string  $to
     * @return void
     */
    public function rename($from, $to)
    {
        $this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) {
            $blueprint->rename($to);
        }));
    }

    /**
     * Enable foreign key constraints.

View on GitHub (pinned to bd6b5437e6)

Solutions

  1. Guard the call by driver: only invoke dropAllTypes() when connected to Postgres.
  2. Switch the connection to pgsql if you genuinely need user-defined type teardown.
  3. Remove the call from cross-driver test harnesses.

Example fix

// before
Schema::dropAllTypes();

// after
if (DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
    Schema::dropAllTypes();
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (! DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
    return; // dropAllTypes only meaningful on Postgres
}
Schema::dropAllTypes();

Type guard

function shouldDropAllTypes(): bool
{
    return DB::connection() instanceof \Illuminate\Database\PostgresConnection;
}

Try / catch

try {
    Schema::dropAllTypes();
} catch (\LogicException $e) {
    // non-Postgres driver — nothing to drop
}

Prevention

When it happens

Trigger: Calling Schema::dropAllTypes(), or having a migration/test path that invokes it, on any connection whose builder is not PostgresBuilder (or another that overrides it).

Common situations: Using migrate:fresh with the Postgres-specific PostgresBuilder behavior expected, but connected to MySQL/SQLite; running a shared test base class that calls dropAllTypes unconditionally across connections.

Related errors


AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06). Data as JSON: /data/errors/bdecaab9bf65242b.json. Report an issue: GitHub.