{"record":{"id":"bdecaab9bf65242b","repo":"laravel/framework","slug":"this-database-driver-does-not-support-dropping-all-bdecaa","errorCode":null,"errorMessage":"This database driver does not support dropping all types.","messagePattern":"This database driver does not support dropping all types\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Builder.php","lineNumber":600,"sourceCode":"     * @return void\n     *\n     * @throws \\LogicException\n     */\n    public function dropAllViews()\n    {\n        throw new LogicException('This database driver does not support dropping all views.');\n    }\n\n    /**\n     * Drop all types from the database.\n     *\n     * @return void\n     *\n     * @throws \\LogicException\n     */\n    public function dropAllTypes()\n    {\n        throw new LogicException('This database driver does not support dropping all types.');\n    }\n\n    /**\n     * Rename a table on the schema.\n     *\n     * @param  string  $from\n     * @param  string  $to\n     * @return void\n     */\n    public function rename($from, $to)\n    {\n        $this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) {\n            $blueprint->rename($to);\n        }));\n    }\n\n    /**\n     * Enable foreign key constraints.","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Builder.php#L582-L618","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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()."],"exampleFix":"// before - throws on MySQL/SQLite/SQL Server\nforeach (config('database.connections') as $name => $_) {\n    Schema::connection($name)->dropAllTypes();\n}\n\n// after - only where the concept exists\nforeach (config('database.connections') as $name => $cfg) {\n    if (($cfg['driver'] ?? null) === 'pgsql') {\n        Schema::connection($name)->dropAllTypes();\n    }\n}","handlingStrategy":"type-guard","validationCode":"use Illuminate\\Database\\PostgresConnection;\n\nif (Schema::getConnection() instanceof PostgresConnection) {\n    Schema::dropAllTypes();\n} else {\n    // user-defined types are a Postgres concept; nothing to do here\n}","typeGuard":"use Illuminate\\Database\\PostgresConnection;\n\nfunction supportsDropAllTypes(\\Illuminate\\Database\\Connection $connection): bool\n{\n    return $connection instanceof PostgresConnection;\n}","tryCatchPattern":"try {\n    Schema::dropAllTypes();\n} catch (\\LogicException $e) {\n    // non-Postgres engine; user-defined types are not applicable\n}","preventionTips":["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."],"tags":["schema","database-driver","postgres","user-defined-types","logic-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}