-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Database seeder output is messed up by new Artisan look #43515
Comments
It is not just seeder, we are running artisan command inside migrations via <?php
return new class extends Migration {
public function up()
{
Artisan::call(CampaignConfigurationMigrationCommand::class, [
'--force' => true,
], new ConsoleOutput());
}
}; One way to fix it by using new component intruduce recently. |
@ankurk91 With the console output improvements, we don't really expect "output" in the middle of seeders. Same goes when calling |
One can do like <?php
class DatabaseSeeder extends Seeder
{
public function run()
{
// So laravel team does not recommand to do this in seeders?
$this->command->info('Importing huge data from csv');
Artisan::call(ImportCSVCommand::class, [
'file' => database_path('raw/huge-csv.csv'),
'--force' => true,
], $this->command->getOutput()); // We should not supply the last argument here?
} I have tried to remove the last parameter from $this->line(now().' Starting file import ...'); which we want to append on the terminal when running from seeder. we have been doing this from years already.
Then we should also deprecate the |
@nunomaduro Doesn't sound like an improvement, at least for me. Wouldn't it be possible to display the output similar to The rows that are used to display the middleware (groups) here could be our output instead. I think this would be a useful addition as there are likely other use cases in the future. |
ping @nunomaduro |
We are going to address this issue soon. |
Description:
In my database seeders I'm writing output to the console via
$this->command->info()
. Unfortunately #43065 messed it up:If you're wondering what I'm doing here: I'm hardcoding the user groups and permissions of my application into seeders. The seeders then keep the database in sync.
Steps To Reproduce:
Create a new seeder an run database seeding:
The text was updated successfully, but these errors were encountered: