konchanxxx / menta

MENTAのタスク管理用リポジトリ
0 stars 0 forks source link

migrationファイルの修正に関して #55

Closed yoshimitsu41 closed 5 years ago

yoshimitsu41 commented 5 years ago

概要

作成したアプリをherokuにデプロイしようとしたのですが、mysql2エラーで heroku run rails db:migrate が途中で止まっていました。

調べたところ全くもってこの減少と同じです。 https://qiita.com/jnchito/items/3525fd22973477b88411

heroku run rake db:migrate:status を実行したところこのようになっています。。。

 Status   Migration ID    Migration Name
--------------------------------------------------
   (3.7ms)  SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
   up     20190311134316  Create clients
   up     20190311135123  Devise create users
   up     20190313110645  Create agreements
   up     20190314010946  Change column to agreement
   up     20190314012827  Remove user id to agreements
   up     20190314013300  Add column to agreement
   up     20190314013603  Create comments
  down    20190321004246  Records userclient
  down    20190321004759  Add user id to clients
  down    20190321011627  Add nickname to users
  down    20190321020351  Add bikou to agreements
  down    20190321030013  Remove maintenance from agreements
  down    20190321033926  Add auto payment to clients
  down    20190321035734  Remove auto payment from agreements

確かにmigrationファイルを修正してしまった記憶があります。。。。

このような場合どのように対処するのがベストでしょうか?

問題となっているアプリケーションのGitHub URL

https://github.com/yoshimitsu41/greenhill.git

konchanxxx commented 5 years ago

今反映されているデータが消えてしまって良いなら

bundle exec rails db:migrate:reset

とかですかね:bow:

yoshimitsu41 commented 5 years ago

ありがとうございます!