Skip to content

Seeding with Pest without touching the main database #427

Answered by spooksie
spooksie asked this question in Q&A
Discussion options

You must be logged in to vote

I added this to my test
ray(env('APP_ENV'), env('DB_CONNECTION'), env('DB_DATABASE'));

It was showing my main connection, so this makes sense. After googling this there is an artisan command called config:clear. I ran the command and tried again. It was showing my main connection again.

How I fixed it in the end

  1. php artisan config:clear
  2. Restart Valet
  3. Restart Mac
  4. php artisan config:clear again
  5. Ran the test again and it worked with the correct database.

Issue solved for now, looks like the caching was causing issues. I don't know if its a Laravel issue or Valet issue.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@spooksie
Comment options

@lukeraymonddowning
Comment options

@spooksie
Comment options

@nunomaduro
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by spooksie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants