How does one change database for development and testing on local system without editing the .env file each time?
I have found it quite inconvenient to
For those, who want to use sqlite for testing
Create a test environment file and test.sqlite file
> cp .env .env.testing
> touch test.sqlite
In .env.testing file
DB_CONNECTION=sqlite
DB_DATABASE=./test.sqlite
Followed by
php artisan config:cache --env=testing
Now again migrate your databases
php artisan migrate
if you need then seed it
php artisan db:seed
And whenever you want to use local env, run
php artisan config:cache --env=local
Please note, env name can be found in .env file as
APP_ENV=local