Skip to content

Commit

Permalink
Only run migration after selecting the database (#337)
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone authored May 13, 2024
1 parent 072e341 commit 5fb6fb6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

$composer = $this->findComposer();
$phpBinary = $this->phpBinary();

$commands = [
$composer." create-project laravel/laravel \"$directory\" $version --remove-vcs --prefer-dist",
$composer." create-project laravel/laravel \"$directory\" $version --remove-vcs --prefer-dist --no-scripts",
$composer." run post-root-package-install -d \"$directory\"",
$phpBinary." \"$directory/artisan\" key:generate --ansi",
];

if ($directory != '.' && $input->getOption('force')) {
Expand Down Expand Up @@ -464,12 +467,12 @@ protected function promptForDatabaseOptions(string $directory, InputInterface $i
default: $defaultDatabase,
));

if ($input->getOption('database') !== 'sqlite') {
$migrate = confirm(
label: 'Default database updated. Would you like to run the default database migrations?',
default: true
);
}
$migrate = confirm(
label: $input->getOption('database') !== 'sqlite'
? 'Default database updated. Would you like to run the default database migrations?'
: 'Would you like to run the default database migrations?',
default: true
);
}

return [$input->getOption('database') ?? $defaultDatabase, $migrate ?? false];
Expand Down

0 comments on commit 5fb6fb6

Please sign in to comment.