LoginSignup
1
0

More than 3 years have passed since last update.

Heroku環境下のテーブル変更作業メモ

Posted at

前提条件と結論

migrateしてから立ち上げないとテーブルの変更を認識しないので気をつけようといいたいだけのメモです。
リスタートするだけでいいし、なんらかの理由でHerokuでデプロイと同時にrake db:migrateを実行することを選択しない場合の備忘録なので、Release Phaseが設定できている場合は読む必要はありません。

  • Ruby on Rails
  • Heroku Postgres
  • --app yourappsは複数環境を持っている場合のお約束

実際のコマンド

# 現在のheroku側のmigrate状況を確認、すべてupになっている
heroku rake db:migrate:status --app yourapps

# herokuにpushした状態で、再度確認。追加分だけdownになっている
heroku rake db:migrate:status --app yourapps

# migration実行
heroku rake db:migrate --app yourapps

# アプリをリスタートしないとテーブルの変更を認識しないので注意
heroku restart --app yourapps

参考資料

1
0
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
1
0