From 7d8a34645e3f71ad19a93a7a91976b8ac7f8d6b9 Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Mon, 24 May 2021 10:58:10 -0400 Subject: [PATCH] Add --force flag to migrations (#1203) --- app/Services/Installer/MigrationService.php | 2 +- app/Services/ModuleService.php | 6 +++--- tests/TestCase.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Services/Installer/MigrationService.php b/app/Services/Installer/MigrationService.php index c95ca0ae..c3dc6908 100644 --- a/app/Services/Installer/MigrationService.php +++ b/app/Services/Installer/MigrationService.php @@ -82,7 +82,7 @@ class MigrationService extends Service // A little ugly, run the main migration first, this makes sure the migration table is there $output = ''; - Artisan::call('migrate'); + Artisan::call('migrate', ['--force' => true]); $output .= trim(Artisan::output()); // Then get any remaining migrations that are left over diff --git a/app/Services/ModuleService.php b/app/Services/ModuleService.php index c3353c00..b9b4c7fd 100644 --- a/app/Services/ModuleService.php +++ b/app/Services/ModuleService.php @@ -126,7 +126,7 @@ class ModuleService extends Service 'enabled' => 1, ]); - Artisan::call('module:migrate '.$module_name); + Artisan::call('module:migrate '.$module_name, ['--force' => true]); return true; } @@ -225,7 +225,7 @@ class ModuleService extends Service } Artisan::call('config:cache'); - Artisan::call('module:migrate '.$module); + Artisan::call('module:migrate '.$module, ['--force' => true]); return flash()->success('Module Installed'); } @@ -246,7 +246,7 @@ class ModuleService extends Service ]); if ($status === true) { - Artisan::call('module:migrate '.$module->name); + Artisan::call('module:migrate '.$module->name, ['--force' => true]); } return true; diff --git a/tests/TestCase.php b/tests/TestCase.php index 52113b14..a63e3ed6 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -60,7 +60,7 @@ abstract class TestCase extends \Illuminate\Foundation\Testing\TestCase Notification::fake(); Artisan::call('database:create', ['--reset' => true]); - Artisan::call('migrate:refresh', ['--env' => 'testing']); + Artisan::call('migrate:refresh', ['--env' => 'testing', '--force' => true]); // $this->disableExceptionHandling(); }