Skip to content

Commit e0f9730

Browse files
[5.x] Re-runs database migrations on Jetstream (#1436)
* Runs database migrations * Refactors * line * removes line * wipe before migrate * Improves confirm * removes line * Re-adds line * wording * Update InstallCommand.php * Update InstallCommand.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 4855a5b commit e0f9730

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: src/Console/InstallCommand.php

+17
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Process\PhpExecutableFinder;
1717
use Symfony\Component\Process\Process;
1818

19+
use function Laravel\Prompts\confirm;
1920
use function Laravel\Prompts\multiselect;
2021
use function Laravel\Prompts\select;
2122

@@ -267,6 +268,8 @@ protected function installLivewireStack()
267268
}
268269

269270
$this->line('');
271+
$this->runDatabaseMigrations();
272+
270273
$this->components->info('Livewire scaffolding installed successfully.');
271274

272275
return true;
@@ -467,6 +470,8 @@ protected function installInertiaStack()
467470
}
468471

469472
$this->line('');
473+
$this->runDatabaseMigrations();
474+
470475
$this->components->info('Inertia scaffolding installed successfully.');
471476

472477
return true;
@@ -733,6 +738,18 @@ protected static function updateNodePackages(callable $callback, $dev = true)
733738
);
734739
}
735740

741+
/**
742+
* Run the database migrations.
743+
*
744+
* @return void
745+
*/
746+
protected function runDatabaseMigrations()
747+
{
748+
if (confirm('New database migrations were added. Would you like to re-run your migrations?', true)) {
749+
$this->call('migrate:fresh', ['--force' => true]);
750+
}
751+
}
752+
736753
/**
737754
* Replace a given string within a given file.
738755
*

0 commit comments

Comments
 (0)