Laravel migrations for testing suite

105 Views Asked by At

When I run the below command locally it should refresh my testing database using the latest seeders however it runs on my app database.

php artisan migrate:fresh --seed --env=testing

I have also tried

php artisan --env=testing migrate:fresh --seed

I have 2 env files, .env and .env.testing.

Each of these files contain their own database settings (all the same except for DB_DATABASE).

.env:

##
# DB
##
DB_CONNECTION="mysql"
DB_DATABASE="app"
DB_HOST="mysql"
DB_USERNAME="app"
DB_PASSWORD="***"
DB_PORT="3306"

.env.testing:

##
# DB
##
DB_CONNECTION="mysql"
DB_DATABASE="testing"
DB_HOST="mysql"
DB_USERNAME="app"
DB_PASSWORD="***"
DB_PORT="3306"

Can anyone advise why the artisan command is not listening to the --env flag and refreshing my main database instead?

0

There are 0 best solutions below