| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function runDatabaseMigrations() |
||
| 21 | { |
||
| 22 | $this->artisan('cache:model:clear'); |
||
|
|
|||
| 23 | |||
| 24 | /* If refresh fails. It usually means the database was only partially migrated or seeded. |
||
| 25 | ** Start fresh if that's the case |
||
| 26 | **/ |
||
| 27 | try { |
||
| 28 | $this->artisan('migrate:refresh'); |
||
| 29 | } catch (\Exception $e) { |
||
| 30 | $this->artisan('cache:model:clear'); |
||
| 31 | $this->artisan('migrate:fresh'); |
||
| 32 | $this->artisan('migrate:refresh'); |
||
| 33 | } |
||
| 34 | $this->artisan('db:seed'); |
||
| 35 | $this->beforeApplicationDestroyed(function () { |
||
| 36 | RefreshDatabaseState::$migrated = false; |
||
| 37 | }); |
||
| 40 |