| 1 | <?php |
||
| 9 | class Mysql implements TableDropper |
||
| 10 | { |
||
| 11 | public function dropAllTables() |
||
| 12 | { |
||
| 13 | Schema::disableForeignKeyConstraints(); |
||
| 14 | |||
| 15 | collect(DB::select("SHOW FULL TABLES WHERE Table_Type = 'BASE TABLE'")) |
||
| 16 | ->map(function (stdClass $tableProperties) { |
||
| 17 | return get_object_vars($tableProperties)[key($tableProperties)]; |
||
| 18 | }) |
||
| 19 | ->each(function (string $tableName) { |
||
| 20 | $tableName = str_after($tableName, Schema::getConnection()->getTablePrefix()) |
||
| 21 | Schema::drop($tableName); |
||
|
|
|||
| 22 | }); |
||
| 23 | |||
| 24 | Schema::enableForeignKeyConstraints(); |
||
| 25 | } |
||
| 26 | } |
||
| 27 |