0
votes

I need some help getting my Cloud 9/Rails environment working again for an online course I'm working on through Upskill. I ran into a problem with one section and ended up rolling back to a previous commit. However, since I did that, I've run into some database errors I haven't been able to resolve.

Here is what I get when I try to access my app:

ActiveRecord::PendingMigrationError Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=development

I've tried the suggested method to resolve it, but it hasn't worked, nor have a dozen other suggestions I've found in other threads with a similar message.

Below is what I see when I run rails db:migrate:status. So I believe maybe it has something to do with the third item there.

Status Migration ID Migration Name

up 20170331144924 Create contacts

up 20170406172755 Devise create users

down 20170410151911 Add devise to users

I am really lost but just hoping to get back to where I was so I can continue with the lessons. Thank you.

2
Will you detail the "half-a-dozen other suggestions"? We can't help very well if we don't know what you have or haven't tried.Kevin Brown
Most of the suggestions have involved deleting the database and recreating it, which I've tried several times but I still get the same error. I have tried several variations of rails db:migrate to no avail. So just not sure what else to try.carelessdonkey
If you don't care about the db data, you may just need to rake db:drop db:create db:migrate. Or, you may need to delete that file, take a look in the db/migrate folder and post what's in there. It looks like it wants to run that migration.Mark Swardstrom
You can also do rake db:schema:load and just delete the migrations files.Eyeslandic
From that error message, it looks as if you are missing a migration that is supposed to create the users table. Are you sure you aren't missing a migration somewhere, that you either deleted or forgot to write?Frost

2 Answers

1
votes

What worked for me was:

rake db:test:purge
rake db:test:prepare
0
votes

Have you tried running a specific migration which is down like this? Ref

rake db:migrate:up VERSION=20170410151911