-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Artisan Migrate env param has no effect #14941
Comments
Due to a subtlety in the implementation, this will only work if you run the config cache clear command first. |
That doesn't seem to make a difference. Content of directory
Relevent content of .env.testing file.
Ran
Run migrate, and it still uses the settings in .env.
I dropped the tables in the normal db (.env has DB_DATABASE as "book"). and it runs on that db.
DB Contents
|
Should |
I was able to replicate the same as reported by @nokios. I will look to add a PR for this. @GrahamCampbell If i generate a PR for this. Should i do it for 5.1 or 5.3? |
5.3 probably. we changed how this worked in 5.2. |
Hello @srmklive :) Have you ever got the chance to do a second PR for this with Taylor's feedback in mind? |
@srmklive How about doing this in |
@themsaid |
Still an issue in 5.7.
|
This helps but running |
Essentially, running
artisan --env=testing migrate
does not actually choose the testing environment.We have .env which is for development, but also .env.testing. PHPUnit picks up the settings in .env.testing, but
artisan --env=testing migrate
does not. It simply uses .env configuration.I've seen some people solve this by adding a 'testing_*' option in config/database.php, then using
artisan migrate --database=testing_*
, but this implies you need to always have a testing option in your database.php file, and seems like it shouldn't be that way.The only way I got migrate to use .env.testing is to run
export APP_ENV=testing
prior to running the command.Using laravel 5.3, php7.0, homestead 0.4.4 on vagrant box.
The text was updated successfully, but these errors were encountered: