Skip to content

Commit 5fb6fb6

Browse files
authored
Only run migration after selecting the database (#337)
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 072e341 commit 5fb6fb6

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/NewCommand.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
158158
}
159159

160160
$composer = $this->findComposer();
161+
$phpBinary = $this->phpBinary();
161162

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

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

467-
if ($input->getOption('database') !== 'sqlite') {
468-
$migrate = confirm(
469-
label: 'Default database updated. Would you like to run the default database migrations?',
470-
default: true
471-
);
472-
}
470+
$migrate = confirm(
471+
label: $input->getOption('database') !== 'sqlite'
472+
? 'Default database updated. Would you like to run the default database migrations?'
473+
: 'Would you like to run the default database migrations?',
474+
default: true
475+
);
473476
}
474477

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

0 commit comments

Comments
 (0)