LoginSignup
30
30

More than 5 years have passed since last update.

ActiveRecord::PendingMigrationError

Posted at

rspecコマンドを実行したところ以下のようなエラーが出ました。

`check_pending!': Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=test' to resolve this issue. (ActiveRecord::PendingMigrationError)

「途中段階のものがあるからチェックして」というエラーのようです。指定通りにコマンドを実行

$ rake db:migrate RAILS_ENV=test

(RAILS_ENVは、テストや本番のデータベースに対して処理を行いたいときに使うオプッション)このコマンドを実行すると、rspecは通りました。ですが、このままではテストデータベースに対してですので、

$ rake db:migrate RAILS_ENV=development

として、デフォルトの開発環境に戻しておきます。

それにしても、$rake db:migrate を実行していたのに、なぜこんなエラーが出たのでしょうね。

30
30
2

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