1
votes

when I go to my http://localhost:3000/ I am getting the following:

ActiveRecord::PendingMigrationError

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

Extracted source:

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

Also, when I tried to to the heroku run rake db:migrate in the console, it said:

StandardError: An error has occurred, this and all later migrations canceled: PG::DuplicateColumn: ERROR: column "email" of relation "users" already exists

I am new to ruby and followed the devise tutorial by Mackenzie Child. It's my last step to complete my first ruby application.

I am excited and looking forward to your help! :)

2

2 Answers

1
votes

In your console run rake db:migrate Make sure you in the project directory

0
votes

You used devise generator to prepare migration for your User model. Your model was already in place before and already had an email column. Devise-generated migration tries to create the same column and, expectedly, fails, that's the reason for the error you're seeing:

PG::DuplicateColumn: ERROR: column "email" of relation "users" already exists

To fix that just open your devise-generated migration and remove the line which looks something like this:

t.string :email...

Then run rake db:migrate.

UPDATE

Since your database seems to be out of sync with your migrations it might be advisable to recreate it from scratch.

Run

rake db:drop db:create db:migrate

Note that all database data will be destroyed.