From 7c1312a8527cf556e08f5b18038a1e3fde392244 Mon Sep 17 00:00:00 2001 From: Jack Sleight Date: Tue, 20 Aug 2024 10:15:05 +0100 Subject: [PATCH 1/5] Fix --no-interaction SQLite file prompt --- src/NewCommand.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index dd0814a..297320b 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -208,9 +208,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->configureDefaultDatabaseConnection($directory, $database, $name); if ($migrate) { - $this->runCommands([ - $this->phpBinary().' artisan migrate', - ], $input, $output, workingPath: $directory); + $commands = [ + trim(sprintf( + $this->phpBinary().' artisan migrate %s', + $input->getOption('no-interaction') ? '--force' : '', + )), + ]; + $this->runCommands($commands, $input, $output, workingPath: $directory); } } From 6caa2e261c59d28bec13aedc75ed92d933c67003 Mon Sep 17 00:00:00 2001 From: Jack Sleight Date: Tue, 20 Aug 2024 10:25:40 +0100 Subject: [PATCH 2/5] Only if it's actually sqlite --- src/NewCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index 297320b..d391dfb 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -211,7 +211,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $commands = [ trim(sprintf( $this->phpBinary().' artisan migrate %s', - $input->getOption('no-interaction') ? '--force' : '', + $database === 'sqlite' && ! $input->isInteractive() ? '--force' : '', )), ]; $this->runCommands($commands, $input, $output, workingPath: $directory); From bab15063e5b8515d4543b6243b813da62c1237db Mon Sep 17 00:00:00 2001 From: Jack Sleight Date: Tue, 20 Aug 2024 14:35:42 +0100 Subject: [PATCH 3/5] Create sqlite file in command --- src/NewCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index d391dfb..160dcc6 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -208,10 +208,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->configureDefaultDatabaseConnection($directory, $database, $name); if ($migrate) { + if ($database === 'sqlite') { + touch($directory.'/database/database.sqlite'); + } $commands = [ trim(sprintf( $this->phpBinary().' artisan migrate %s', - $database === 'sqlite' && ! $input->isInteractive() ? '--force' : '', + ! $input->isInteractive() ? '--force' : '', )), ]; $this->runCommands($commands, $input, $output, workingPath: $directory); From 32d45c69f0dc42741f7c4290910e12bf5a4c4b11 Mon Sep 17 00:00:00 2001 From: Jack Sleight Date: Tue, 20 Aug 2024 14:36:36 +0100 Subject: [PATCH 4/5] Pass correct option --- src/NewCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index 160dcc6..cd5c482 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -214,7 +214,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $commands = [ trim(sprintf( $this->phpBinary().' artisan migrate %s', - ! $input->isInteractive() ? '--force' : '', + ! $input->isInteractive() ? '--no-interaction' : '', )), ]; $this->runCommands($commands, $input, $output, workingPath: $directory); From f9139d70b48d31444f57672d2ea8bd4b9b898d9e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 21 Aug 2024 21:42:38 -0500 Subject: [PATCH 5/5] Update NewCommand.php --- src/NewCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/NewCommand.php b/src/NewCommand.php index cd5c482..242295d 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -211,12 +211,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($database === 'sqlite') { touch($directory.'/database/database.sqlite'); } + $commands = [ trim(sprintf( $this->phpBinary().' artisan migrate %s', ! $input->isInteractive() ? '--no-interaction' : '', )), ]; + $this->runCommands($commands, $input, $output, workingPath: $directory); } }