Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
131
Help us understand the problem. What is going on with this article?
@pugiemonn

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

More than 3 years have passed since last update.

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を実行するとエラーが出なくなります。

131
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
pugiemonn
GoogleTagManagerを利用してGAを操るようなマーケターとしてお仕事しています
pugiemonn_com
pugiemonn.com

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
131
Help us understand the problem. What is going on with this article?