Skip to content

Commit 76a7b3c

Browse files
authored
Fix seeder property for in-memory tests (#41869)
1 parent 45de4c4 commit 76a7b3c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Illuminate/Database/Console/Migrations/MigrateCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class MigrateCommand extends BaseCommand
2424
{--schema-path= : The path to a schema dump file}
2525
{--pretend : Dump the SQL queries that would be run}
2626
{--seed : Indicates if the seed task should be re-run}
27+
{--seeder= : The class name of the root seeder}
2728
{--step : Force the migrations to be run so they can be rolled back individually}';
2829

2930
/**
@@ -89,7 +90,10 @@ public function handle()
8990
// seed task to re-populate the database, which is convenient when adding
9091
// a migration and a seed at the same time, as it is only this command.
9192
if ($this->option('seed') && ! $this->option('pretend')) {
92-
$this->call('db:seed', ['--force' => true]);
93+
$this->call('db:seed', [
94+
'--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder',
95+
'--force' => true,
96+
]);
9397
}
9498
});
9599

src/Illuminate/Foundation/Testing/RefreshDatabase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ protected function migrateUsing()
5656
{
5757
return [
5858
'--seed' => $this->shouldSeed(),
59+
'--seeder' => $this->seeder(),
5960
];
6061
}
6162

0 commit comments

Comments
 (0)