Answer the question
In order to leave comments, you need to log in
How to roll migration in laravel 5.8 and run tests from test .env.testing environment?
Good afternoon,
There are files with a key section:
.env:
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=54321
DB_DATABASE=app
DB_USERNAME=app
DB_PASSWORD=secret
.env.testing:
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=
54322 =app_test
DB_USERNAME=app_test
DB_PASSWORD=secret_test
From under docker I run:
docker-compose exec php-cli php artisan migrate --env=testing
clear-cache:
$(_EXEC) $(_CLI_CTR) php artisan cache:clear
$(_EXEC) $(_CLI_CTR) php artisan view:clear
$(_EXEC) $(_CLI_CTR) php artisan config:cache
$(_EXEC) $(_CLI_CTR) php artisan route:cache
$(_SUDO) cat /dev/null > $(APP_PATH)/storage/logs/laravel.log
$(_SUDO) rm -f $(APP_PATH)/cache/packages.php
$(_SUDO) rm -f $(APP_PATH)/cache/services.php
<env name="DB_PORT" value="54322"/>
<env name="DB_DATABASE" value="app_test"/>
<env name="DB_USERNAME" value="app_test"/>
<env name="DB_PASSWORD" value="secret_test"/>
Answer the question
In order to leave comments, you need to log in
Because this is the environment. What is the point of having environment variables if they are committed somewhere anyway?
And if they don’t commit, then what’s the point of two .env files? env is only read from .env and nowhere else (and shouldn't be).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question