LoginSignup
0
0

More than 3 years have passed since last update.

ActiveRecord::PendingMigrationError解決方法

Posted at

・実行中の作業
Railsでブラウザにアクセスしトップページを表示
・問題点
トップページ表示中にActiveRecord::PendingMigrationErrorと言われる

PendingMigrationError

以下エラー内容

エラー
      # Raises <tt>ActiveRecord::PendingMigrationError</tt> error if any migrations are pending.
      def check_pending!(connection = Base.connection)
        raise ActiveRecord::PendingMigrationError if connection.migration_context.needs_migration?
      end

      def load_schema_if_pending!

トップページの表示のみなので必要ないかと判断していましたが
きちんとMigrationしてください、とあります。

rails db:migrateを実行する

migrate
rails db:migrate
== 20201016135035 Createディレクトリ名: migrating ===================================
-- create_table(:ディレクトリ名)
   -> 0.0111s
== 20201016135035 Createディレクトリ名: migrated (0.0112s) ==========================

以上でマイグレーションが実行済み

rails sを実行し確認

エラー解決できました。

まとめ

今回は初歩的なミスですがトップページの表示のみを行いたかったのですが、マイグレーションで引っかかるのは想定外でした。

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