Ruby-on-rails ActiveRecord::PendingMigrationError?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21617352/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 23:20:16  来源:igfitidea点击:

ActiveRecord::PendingMigrationError?

ruby-on-railsruby

提问by Ben D

I can't find a solution for this but here is a screenshot of the error.

我找不到解决方案,但这是错误的屏幕截图。

This is what the error looks like when I go to the page localhost:3000

这是我转到页面 localhost:3000 时的错误样子

回答by nickcoxdotme

Stop your server at the command line, and run this:

在命令行停止你的服务器,然后运行:

bundle exec rake db:migrate

bundle exec rake db:migrate

Looks like you've written a migration, but haven't migrated your database yet.

看起来您已经编写了迁移,但尚未迁移您的数据库。

回答by SWETHA

you might be in wrong directory ? i was running rails server from wrong folder when i got this error.

你可能在错误的目录中?当我收到此错误时,我正在从错误的文件夹中运行 Rails 服务器。

回答by Thamizharasan Jayakumar

Run console:

运行控制台:

bundle exec rake db:migrate

捆绑执行耙分贝:迁移

回答by Rohit Goyal

prepare the migration for test using this command.

使用此命令准备迁移以进行测试。

rake test:prepare

It should work now.

它现在应该可以工作了。