[5.5] artisan migrate:fresh with --seed and --no-interact does not pass --no-interact on to seeders #29456
Description
- Laravel Version: 5.5.46
- PHP Version: 7.2.19
- Database Driver & Version: libmysql - mysqlnd 5.0.12-dev - 20150407 (MariaDB 10.3.11)
Description:
When running php artisan migrate:fresh --seed --no-interact
, the --no-interact
option is not passed along when running the DatabaseSeeder
, thus I end up being asked things from my interactive seeders instead of them using the defaults.
Running php artisan db:seed --no-interact
works well. db:seed
just runs DatabaseSeeder
that again just has a bunch of $this->call('SeederName');
s, but all of those seeder get the --no-interact
option applied.
Wouldn't it make sense for this to be the case when running migrate:fresh --seed --no-interact
as well?
I have tested this in Laravel 5.8.31 as well, and this does not happen there, so is has likely been fixed at some point, but not backported to 5.5?
Edit: this is also related to #27009 and #27012.
Steps To Reproduce:
- Create a seeder that asks a question, using
$this->command->ask()
- and provide a default answer. - Add your seeder to
database/seeds/DatabaseSeeder.php
- Run
php artisan db:seed -n
and see that it is seeded without the question appearing, defaulting to the correct value - Run
php artisan migrate:fresh --seed -n
and see that the migrations are re-run successfully, but when starting to seed it will ask your quesiton, halting the process if it is scripted.
Workaround
php artisan migrate:fresh && php artisan db:seed -n