Getting: “Migrations are pending; run 'bin/rak

2020-02-16 07:17发布

I cloned my project. Bundled with "bundle install", then run "rake db:migrate". I am getting this error: (when I run the rails server and open my browser to localhost:3000) "Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue."

I checked all migrations one by one and all were executed without errors. Also no errors were shown after the execution of "rake db:migrate".

This is what I see when I execute "rake db:migrate:status"

I am on development environment. Please let me know if you need any other information.

I also tried "bundle exec rake db:migrate", and "bundle exec rake db:migrate:reset" as "burninggramma" suggested.

Any clues what causes the error?

15条回答
等我变得足够好
2楼-- · 2020-02-16 08:05

After running the migrate command, I still had the same error.

What worked for me was to just stop the rails server and start it again.

查看更多
The star\"
3楼-- · 2020-02-16 08:07

Interesting. Did you run rake db:create? Assuming you are using sqlite3, do this:

      rm -f db/*.sqlite3
      rake db:create
      RAILS_ENV=development rake db:migrate
      rails s -e development

Also, can you list the contents of your config/database.yml file?

Edit: Warning! Obviously, you will lose your existing data.

查看更多
孤傲高冷的网名
4楼-- · 2020-02-16 08:08

I had the same problem in genieacs and this code helped:

rake db:drop rake db:create rake db:schema:load RAILS_ENV=development
rake db:migrate rails s -e development
查看更多
我命由我不由天
5楼-- · 2020-02-16 08:10

Here's what worked for me: -gem install rails -v 4.1.0 Inside Gemfile: -gem 'rails', '4.1.0' (replace the newer/older with this) Do bundle install and update -bundle install -bundle update In your application.rb : Remove/Comment - config.active_record.raise_in_transactional_callbacks = true

run bundle rake: -bundle exec rake db:migrate Refresh your page and the error should be gone.

查看更多
beautiful°
6楼-- · 2020-02-16 08:13

You can always run rake db:reset

查看更多
兄弟一词,经得起流年.
7楼-- · 2020-02-16 08:14

I had this problem and it was because I had my rails files inside a folder named "[rails]". It seems rake doesn't like the following symbols "[]" used in a folder name.

Hope this helps others with this issue.

查看更多
登录 后发表回答