• Register
0 votes

Problem :

I cloned my project and bundled it with "bundle install" after that tried to run it using  "rake db:migrate" but facing following error
migrations are pending. to resolve this issue, run: bin/rails db:migrate rails_env=development
6 5 3
6,930 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

When one faces such issue one should just Open the database and click on schema_migration table. Then one can see migrations listed as below. enter image description here

Then you just need to Sort the version column and find the latest migration you want to go back to. Then you can Delete or Insert a new one. Rails always keeps all the migration history in this table, so you can adjust the migration history to your liking.

9 7 4
38,600 points
0 votes

This error can be solved in many ways because there many reasons behind this error;

Duplication of the table:

Always make sure that the table does not exist already. This can be done in the following steps;

  • Type- rails dbconsole
  • Type – tables (Check to see if there is an error during the rake db: migrate that has the table name like, create_table(: test) rake aborted!)
  • If you see the table name after running the .tables in the console type then drop table TABLENAME;
  • Then .quit to go back to branch again and run the rake db: migrate command again.
  • Another option of resetting the whole database  - use with caution! Reset all the data as well – bundle exec rake db:migrate: reset

For making sure you are running everything in the same development environment;

RAILS_ENV=development bundle exec rake db:migrate:reset

RAILS_ENV=development bundle exec rails s


  • Go to the database.
  • Click the schema_migration table. You can see the migration list;
  • Sort the versions columns and find the latest migrations if you want to go back.
  • Delete or insert the new one.
  • Rails can keep all the migration history in this table. So, you can adjust the migration history according to your requirement.
11 5 2
3,890 points

Related questions

0 votes
1 answer 31 views
Problem: t looks like I have a circular issue regarding Ruby over Rails migration procedure. I am following the online available article and now reached the point where I need to modify my very first table. I ran the following, [tims@web2 working_ror]# rails generate model ... was to drop and rebuild everything below. rake db: drop rake db: create rake db: distant and the conclusions are all same.
asked Dec 1, 2020 sasha 16.2k points
0 votes
1 answer 90 views
Problem: Hello Kodlogs, I tried pushing my app and I got an error message of this nature; you must use bundler 2 or greater with this lockfile. What can I do to correct this?
asked Nov 2, 2020 Festus James 380 points
0 votes
1 answer 21 views
Problem: no ransack::search object was provided to search_form_for!
asked Feb 20 charles mathews 5.5k points
0 votes
1 answer 42 views
Problem: Hello Kodlogs, I was working on an app I want to deploy for use within my business but I was faced with a hosting issue so I decided to fix it with Heroku using a custom domain and I got this error: installing doc 3.12.2 installing pg 0.15.1 an ... failed to install gems via bundler. ! ! detected sqlite3 gem which is not supported on heroku. ! ! push rejected, failed to compile ruby app
asked Jan 14 Festus James 380 points
1 vote
1 answer 576 views
Problem: I am beginner to ruby on rails. Recently I have started learning ruby on rails in depth. I am trying to use the ruby on rails to develop my website but I am facing below error whenever I try to open the localhost. could not connect to server: Connection refused ... can’t fix the error so now I am looking for help from ruby on rails expert to give me the quick fix for above error.
asked May 18, 2020 Martin K 6.6k points
0 votes
1 answer 5 views
Problem: I have a Result that belongs to a Website. After I create the website I also create the result and redirect to its edit page. Here I want to add some more values. My problem is: When I try to update my Result, then I get: param is missing or the value is empty: result
asked Apr 2 ummesalma 24.5k points
0 votes
1 answer 49 views
Problem: Hello Kodlogs, I encountered a strange issue where vagrant works fine for a while and it completely stops working unexpectedly. Afterward, any of the vagrant commands I run just give me this error: "exec error: exec: "ruby": executable file not found in %PATH%"
asked Dec 29, 2020 Festus James 380 points
0 votes
1 answer 56 views
Problem: Hello Kodlogs, I tried installing Ruby with rbenv. I used homebrew to install rbenv ~ $ brew install rbenv That process was successful. Then I proceeded to install the ruby version of 2.6.1 in rbenv but it kept hanging on the following line. ~ $ rbenv install 2.6. ... .tar.bz2 Installing ruby-2.6.1... ruby-build: use readline from homebrew I think it's stuck, can someone help me fix this?
asked Dec 29, 2020 Festus James 380 points
0 votes
1 answer 71 views
Problem: Hello Kodlogs, Playing my way around with this code contact_list = [ {"name" => "jack", "phone_number" => "6789"}, {"name" => "Tracy", "phone_number" => "2345"} ] contact_list.each do |contact| puts "Contact: #{contact_list["name"]} and ... : #{contact_list["phone_number"]}" end It returns: no implicit conversion of String into Integer (TypeError) How do I correct this I'm confused?
asked Nov 8, 2020 Festus James 380 points