6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

herokuでデプロイ後自動でMigrateさせる

Posted at

はじめに

herokuはRelease Phaseという機能があり、デプロイするごとに自動でスクリプトなど発火させる機能があります

今回Laravelのmigrationをデプロイの度に発火させます

対応はProckfileに1行追加するだけで終わります

relase: {スクリプト}

Procfile

release: php artisan migrate:fresh --force
web: vendor/bin/heroku-php-apache2 public

解説

freshオプションは任意で

--forceは、Laravelは本番環境だとyesか聞かれるので強制的にmigrateさせます

終わりに

日本語の記事が少なく、--forceとかで少し詰まった・・・

一行追加するだけなので、楽ちん!

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?