0
0

More than 3 years have passed since last update.

HerokuのDB再構築

Last updated at Posted at 2021-03-18

下記手順でDB再構築しています。

テスト段階でDBの変更をよくしていたので手順だけ忘れないように残しておきます。

① DBのリセット

$ heroku pg:reset DATABASE_URL

コマンドを実行すると
 >
 ↑で画面が止まるのでアプリ名を入れる。

② マイグレーション(再構築)

$ heroku run rake db:migrate

③ Herokuの再起動

$ heroku restart --app APP_NAME

migrateした後に再起動しないとエラーが出る時があるらしいので下記を実行。[APP_NAME]をアプリ名に変える。

④ データseeds

$ heroku run rails db:seed

AWSでデプロイしている場合であれば
rake db:seed RAILS_ENV=production
とQiitaに書いてあったが
AWSとPaiza.cloud共に上記で行けたので今はこれで行ってる。

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