Vapor: are you using the right database?

Laravel Vapor is amazing.

But despite all its nice bells and whistles, human error can always find its way in.

On one of my projects, I mixed up some environment settings and connected to the wrong database. Ouch! Seems I’m not a robot after all.

Luckily, I was only overwriting old dummy data…

Nevertheless, I wrote a little command that helps me prevent this from happening again. It’s a simple check I’ve now added as the first build step on each Vapor deployment:

deploy:
    - 'php artisan ensure:database:is staging'
    - '<other deploy steps here...>'

Here is the command, enjoy!

(Header photo by Jan Antonin Kolar)

Create your first Laravel package

Laravel package development from scratch

Learning Laravel package development doesn't have to be hard. If you know how to create a basic Laravel app, you can write packages as well.

I've opened this course up for free to the first 100 subscribers only.

Join now and get the first lesson in your inbox right away.

We won't send you spam. Unsubscribe at any time. Powered by ConvertKit

Leave a Reply

Your email address will not be published. Required fields are marked *