Search code examples
laravelherokucomposer-phpartisan-migrate

Is it a good practice to run automatically php artisan migrate in production after a deploy on Heroku?


I was wondering if it's a good practice to run automatically php artisan migrate in production after a deploy on Heroku.

Thanks for your help!


Solution

  • I think it depends on how well you test your code and migrations. If you test your code with every deploy and ensure everything works as it should, you could migrate. Do note that migrating takes time, and this means you should shut down the site until the migrations are done, with Laravel maintenance mode for example (https://laravel.com/docs/5.7/configuration#maintenance-mode).

    If you don't test your code, you should. If you automatically deploy to a server you have to be 100% certain the code will work.