{"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":"critical","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/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Schema/Builder.php#L558-L594","documentation":"The base Schema\\Builder::dropAllTables() throws a LogicException because the driver in use did not override it. Each concrete builder (MySqlBuilder, PostgresBuilder, SQLiteBuilder, SqlServerBuilder) that supports the operation overrides this method; any driver whose builder lacks the override will hit the base implementation. This is a hard capability gap, not a transient failure.","triggerScenarios":"Calling Schema::dropAllTables(), Artisan migrate:fresh, or any code path that invokes it (e.g. testing teardown / RefreshDatabase / DatabaseMigrations trait with an unsupported driver) while connected through a Connection whose SchemaBuilder is the base or an incomplete subclass.","commonSituations":"Wiring a custom/obscure PDO driver that extends Connection but does not provide a SchemaBuilder subclass with dropAllTables; pointing a test suite at a DB engine whose driver lacks the override; using a community driver package that is incomplete against the Laravel version in use.","solutions":["Switch the DB connection to a first-class driver (mysql, pgsql, sqlite, sqlsrv) whose builder overrides dropAllTables.","If you maintain a custom driver, subclass Schema\\Builder and implement dropAllTables() with the engine's native 'drop all' SQL.","For tests, use SQLite in-memory (sqlite::memory:) which supports dropAllTables, instead of an unsupported engine.","Avoid migrate:fresh on the unsupported connection; use migrate:rollback or individual Schema::drop() calls instead."],"exampleFix":"// before — connection 'foo' uses a driver whose Builder does not override dropAllTables\nSchema::connection('foo')->dropAllTables();\n\n// after — implement on your custom builder\nclass FooBuilder extends \\Illuminate\\Database\\Schema\\Builder\n{\n    public function dropAllTables(): void\n    {\n        $this->connection->statement('DROP TABLE ...'); // engine-specific\n    }\n}","handlingStrategy":"type-guard","validationCode":"$builder = Schema::getConnection()->getSchemaBuilder();\nif ((new \\ReflectionMethod($builder, 'dropAllTables'))->getDeclaringClass()->getName()\n    === \\Illuminate\\Database\\Schema\\Builder::class) {\n    throw new \\RuntimeException('dropAllTables not supported by driver '.DB::connection()->getDriverName());\n}","typeGuard":"function driverSupportsDropAllTables(): bool\n{\n    $builder = Schema::getConnection()->getSchemaBuilder();\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    // driver lacks support — surface to caller, do not silently continue\n    throw $e;\n}","preventionTips":["Only run migrate:fresh / dropAllTables on first-class drivers.","Pin test DB to sqlite::memory: or a real mysql/pgsql instance.","Implement the method on any custom Schema\\Builder subclass.","Guard with driver type before invoking in shared code."],"tags":["schema","database","driver-support","testing"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}