{"record":{"id":"9b1031d54dfd0696","repo":"laravel/framework","slug":"this-database-driver-does-not-support-dropping-all","errorCode":null,"errorMessage":"This database driver does not support dropping all tables.","messagePattern":"This database driver does not support dropping all tables\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Builder.php","lineNumber":576,"sourceCode":"     * @return void\n     */\n    public function dropColumns($table, $columns)\n    {\n        $this->table($table, function (Blueprint $blueprint) use ($columns) {\n            $blueprint->dropColumn($columns);\n        });\n    }\n\n    /**\n     * Drop all tables from the database.\n     *\n     * @return void\n     *\n     * @throws \\LogicException\n     */\n    public function dropAllTables()\n    {\n        throw new LogicException('This database driver does not support dropping all tables.');\n    }\n\n    /**\n     * Drop all views from the database.\n     *\n     * @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","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Builder.php#L558-L594","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Switch to a connection whose driver implements dropAllTables (mysql, sqlite, pgsql, sqlsrv) for the migrate:fresh workflow.","If you maintain the driver, override dropAllTables() in your driver's Builder with the engine-appropriate truncation/DROP statement.","Replace migrate:fresh with migrate:rollback / migrate:refresh, which do not call dropAllTables.","Drop tables explicitly with Schema::drop() per table instead of the bulk operation."],"exampleFix":"// before (throws on a driver without dropAllTables)\nSchema::connection('clickhouse')->dropAllTables();\n\n// after - drop the specific tables you know about\nforeach (['events', 'logs', 'metrics'] as $t) {\n    Schema::connection('clickhouse')->dropIfExists($t);\n}","handlingStrategy":"type-guard","validationCode":"$builder = Schema::connection($name)->getConnection()->getSchemaBuilder();\nif ((new \\ReflectionMethod($builder, 'dropAllTables'))->getDeclaringClass()->getName() === \\Illuminate\\Database\\Schema\\Builder::class) {\n    throw new \\DomainException(\"Connection '{$name}' does not support dropAllTables; skipping.\");\n}\n$builder->dropAllTables();","typeGuard":"function supportsDropAllTables(\\Illuminate\\Database\\Schema\\Builder $builder): bool\n{\n    return (new \\ReflectionMethod($builder, 'dropAllTables'))\n        ->getDeclaringClass()->getName() !== \\Illuminate\\Database\\Schema\\Builder::class;\n}","tryCatchPattern":"try {\n    Schema::dropAllTables();\n} catch (\\LogicException $e) {\n    // expected on drivers without a dropAllTables override; fall back to per-table drops\n    foreach (Schema::getTableListing() as $table) {\n        Schema::drop($table);\n    }\n}","preventionTips":["Check the connection driver before calling any dropAll* method.","Avoid migrate:fresh against drivers you do not maintain; use migrate:rollback instead.","Maintain a list of supported capabilities per connection in config and gate teardown routines by it."],"tags":["schema","database-driver","migration","logic-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}