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
Schema\Builder::dropAllTypes() is a LogicException stub on the base class and is overridden ONLY by PostgresBuilder. User-defined types (enums, composites, domains) are a Postgres-centric concept; MySQL/SQLite/SQL Server builders inherit the throwing stub. Calling it on anything other than a Postgres connection is a guaranteed throw.
Solutions
- Restrict the call to Postgres connections: gate on $builder->getConnection() instanceof PostgresConnection.
- Remove the call for non-Postgres engines - they have no equivalent user-defined type catalog to clear.
- If you genuinely need enum/type cleanup on another engine, issue engine-specific DDL directly rather than via dropAllTypes().
Example fix
// before - throws on MySQL/SQLite/SQL Server
foreach (config('database.connections') as $name => $_) {
Schema::connection($name)->dropAllTypes();
}
// after - only where the concept exists
foreach (config('database.connections') as $name => $cfg) {
if (($cfg['driver'] ?? null) === 'pgsql') {
Schema::connection($name)->dropAllTypes();
}
} Defensive patterns
Strategy: type-guard
Validate before calling
use Illuminate\Database\PostgresConnection;
if (Schema::getConnection() instanceof PostgresConnection) {
Schema::dropAllTypes();
} else {
// user-defined types are a Postgres concept; nothing to do here
} Type guard
use Illuminate\Database\PostgresConnection;
function supportsDropAllTypes(\Illuminate\Database\Connection $connection): bool
{
return $connection instanceof PostgresConnection;
} Try / catch
try {
Schema::dropAllTypes();
} catch (\LogicException $e) {
// non-Postgres engine; user-defined types are not applicable
} Prevention
- Only call dropAllTypes() on Postgres connections.
- When iterating connections for teardown, branch on driver rather than calling every dropAll* method.
- Remember migrate:fresh already calls dropAllTypes on Postgres internally - do not duplicate it.
When it happens
Trigger: Schema::dropAllTypes() invoked on a MySQL, SQLite, or SQL Server connection, or any non-Postgres custom driver. Reachable from migrate:fresh on Postgres (which calls it) - but if a migration or service provider manually calls it on the wrong connection it throws immediately.
Common situations: A polymorphic teardown routine that calls dropAllTypes() on every configured connection regardless of engine; copying a Postgres migration verbatim onto a MySQL connection; a generic test helper that iterates connections and calls every dropAll* method.
Related errors
- This database driver does not support retrieving…
- Extensions are only supported by Postgres.
- The database driver in use does not support vector indexes.
- This database driver does not support dropping all tables.
- This database driver does not support dropping all views.
AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11).
Data as JSON: /api/errors/bdecaab9bf65242b.
Report an issue: GitHub.
Appendix: 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 e0f6eb3518)