| Conditions | 1 |
| Paths | 1 |
| Total Lines | 30 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function dropAllTables() |
||
| 12 | { |
||
| 13 | Schema::disableForeignKeyConstraints(); |
||
| 14 | |||
| 15 | collect(DB::select("SHOW FULL TABLES WHERE Table_Type = 'BASE TABLE'")) |
||
| 16 | ->map( |
||
| 17 | function (stdClass $tableProperties) { |
||
| 18 | return get_object_vars($tableProperties)[key($tableProperties)]; |
||
| 19 | } |
||
| 20 | ) |
||
| 21 | ->each( |
||
| 22 | function (string $tableName) { |
||
| 23 | Schema::drop($tableName); |
||
| 24 | } |
||
| 25 | ); |
||
| 26 | |||
| 27 | collect(DB::select("SHOW FULL TABLES WHERE Table_Type = 'VIEW'")) |
||
| 28 | ->map( |
||
| 29 | function (stdClass $tableProperties) { |
||
| 30 | return get_object_vars($tableProperties)[key($tableProperties)]; |
||
| 31 | } |
||
| 32 | ) |
||
| 33 | ->each( |
||
| 34 | function (string $viewName) { |
||
| 35 | DB::statement('DROP VIEW '.$viewName); |
||
| 36 | } |
||
| 37 | ); |
||
| 38 | |||
| 39 | Schema::enableForeignKeyConstraints(); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |