diff --git a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php index 2b07dc94a540..2db166a88937 100755 --- a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -10,6 +10,7 @@ use Illuminate\Database\SQLiteDatabaseDoesNotExistException; use Illuminate\Database\SqlServerConnection; use PDOException; +use RuntimeException; use Symfony\Component\Console\Attribute\AsCommand; use Throwable; @@ -187,6 +188,8 @@ protected function repositoryExists() * * @param string $path * @return bool + * + * @throws \RuntimeException */ protected function createMissingSqliteDatabase($path) { @@ -201,7 +204,9 @@ protected function createMissingSqliteDatabase($path) $this->components->warn('The SQLite database configured for this application does not exist: '.$path); if (! confirm('Would you like to create it?', default: true)) { - return false; + $this->components->info('Operation cancelled. No database was created.'); + + throw new RuntimeException('Database was not created. Aborting migration.'); } return touch($path); @@ -211,6 +216,8 @@ protected function createMissingSqliteDatabase($path) * Create a missing MySQL database. * * @return bool + * + * @throws \RuntimeException */ protected function createMissingMysqlDatabase($connection) { @@ -226,7 +233,9 @@ protected function createMissingMysqlDatabase($connection) $this->components->warn("The database '{$connection->getDatabaseName()}' does not exist on the '{$connection->getName()}' connection."); if (! confirm('Would you like to create it?', default: true)) { - return false; + $this->components->info('Operation cancelled. No database was created.'); + + throw new RuntimeException('Database was not created. Aborting migration.'); } }