Checking for the environment variable is a clean way if you ask me. Is this some dev tool required table since you can't have it in production?
Oct 14, 2019
2
Level 4
Migration: how to execute only in development?
I'm creating a very specific use-case package for laravel. My package is adding a migration, but I absolutely must ensure that migration is NEVER executed if not in development environment.
Is there a way to allow a migration only on dev?
I think to test if .env === 'local', and do the migration only if this is true. In case of false, I simply return true to allow deploy flow to not be changed in any way.
Is there a more beautiful way? Or do you know any potential issues ?
Please or to participate in this conversation.