You can use --path to specify one or more paths
php artisan migrate --path database/migrations/onboarding-form
//or
$this->artisan('migrate:refresh', ['--path' => 'database/migrations/onboarding-form']);
Summer Sale! All accounts are 50% off this week.
Hey guys, I have two directories with migrations. Default migrations are in "database/migrations". My additional migrations which are related only to one part of the app are in "database/migrations/onboarding-form". I figured out that the test doesn't run migrations from "database/migrations/onboarding-form" but only the default migrations. Is there anybody who knows how can I run tests which will run all migrations, from other locations and from the default one? Thanks!
Yes, you can explicitly run migrations in the sub directory if you modify the createApplication method, e.g.
// tests/CreatesApplication.php
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
// add this
$this->afterApplicationCreated(function () {
$this->artisan(‘migrate’, [‘—path’ => ‘database/migrations/onboarding-form’]);
});
return $app;
}
Please or to participate in this conversation.