Closed freekmurze closed 7 years ago
Code to drop all tables:
Schema::disableForeignKeyConstraints(); collect(DB::select("SHOW FULL TABLES WHERE Table_Type = 'BASE TABLE'")) ->map(function (stdClass $tableProperties) { return get_object_vars($tableProperties)[key($tableProperties)]; }) ->each(function (string $tableName) { DB::table($tableName)->truncate(); }); Schema::enableForeignKeyConstraints();
Could just the TableDropperFactory to perform this.
This should replace all manual truncate calls
truncate
Code to drop all tables: