145
136

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.

ActiveRecord::PendingMigrationError と言われた時の解決方法

Last updated at Posted at 2015-11-27

RailsでブラウザからアクセスしたところPendingMigrationErrorエラーがでました。

PendingMigrationErrorがでる

以下がエラーの内容です。

エラー
ActiveRecord::PendingMigrationError (

Migrations are pending. To resolve this issue, run:

	bin/rake db:migrate RAILS_ENV=development

):

Migrationsが未解決なのでmigrateしろとあります。

rake db:migrate を実行

migrateします。

migrate
bundle exec rake db:migrate 
== 20150917031451 CreateActivities: migrating =================================
-- create_table(:activities)
   -> 0.0192s
-- add_index(:activities, [:trackable_id, :trackable_type])
   -> 0.0077s
-- add_index(:activities, [:owner_id, :owner_type])
   -> 0.0067s
-- add_index(:activities, [:recipient_id, :recipient_type])
   -> 0.0068s
== 20150917031451 CreateActivities: migrated (0.0415s) ========================

migrationファイルが実行され、ボクの環境の場合はactivitesテーブルが生成されました。

再度 rails s

serverをstart
bundle exec rails s -b 0.0.0.0 -p 8888

エラーがでなくなりました。
Migrationを保留しているというエラーだったのでMigrationを実行するとエラーが出なくなります。

145
136
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
145
136

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?