Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only run migration after selecting the database #337

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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