Reputation: 43
When I run tests I call migrate:fresh. The schema file is not running. I'm using mysql database for testing. migrate:fresh runs well in other environments. please anyone has an idea?
This is the command I'm using:
Artisan::call('migrate:fresh')
Upvotes: 0
Views: 692
Reputation: 53
This probably happens because your test database doesn't have the same name as your dumped database, so laravel can't find the migration. A work around could be manually specify the dump path to the RefreshDatabase trait like that:
namespace Tests;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication, RefreshDatabase;
protected function migrateFreshUsing()
{
return ['--schema-path' => 'database/schema/mysql-schema.dump'];
}
}
Upvotes: 2