Run migrations in the release, not in a request

php artisan migrate --force belongs in the release step. A Vue button must not be the thing that migrates production.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/laravel-migrate-on-deploy-vue.md
php artisan migrate --force belongs in the release step. A Vue button must not be the thing that migrates production.
Do not call Artisan::call('migrate') from a controller the Vue page can hit.
Do not migrate from a queued job "so the request stays fast".
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Laravel migrate on deploy” hit the site once so AppServiceProvider can run migrations. Run them in the release, before the new code serves traffic. The deploy guide lists this command.

TL;DR

  • php artisan migrate —force belongs in the release step.
  • A Vue button must not be the thing that migrates production.
  • Do not call Artisan::call('migrate') from a controller the Vue page can hit.
  • Do not migrate from a queued job “so the request stays fast”.

Who it's for: Laravel + Vue developers

Applies to: Laravel 13 · Vue 3

The fix#

shell
php artisan migrate --force

--force is required when APP_ENV is production. It answers yes. Read the migration before you ship it. A down() that drops a column is not a small mistake.

What to avoid#

Gotcha

Do not call Artisan::call('migrate') from a controller the Vue page can hit. Two deploys, or two curious browsers, should not race that. Do not migrate from a queued job “so the request stays fast”. The new code and the old schema would be live together until the job runs.

FAQ#

How do I run migrations in the release, not in a request?

php artisan migrate --force belongs in the release step. A Vue button must not be the thing that migrates production.

What goes wrong with Laravel migrate on deploy?

Many developers hit the site once so AppServiceProvider can run migrations. Do not call Artisan::call('migrate') from a controller the Vue page can hit.

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.