Hara Jang
Hara Jang

Reputation: 41

Ruby on Rails error ActiveRecord::PendingMigrationError

this is what I get when I run the project Hi, I'm working on a project. When I run my project, I got this problem: Migrations are pending. To resolve this issue, run:

bin/rake db:migrate RAILS_ENV=development
 raise ActiveRecord::PendingMigrationError if ActiveRecord::Migrator.needs_migration?

(connection)

I've already tried several solutions below:

1)

rake db:drop
rake db:create
rake db:migrate

2) bundle exec rake db:migrate

3) bin/rake db:migrate RAILS_ENV=development

but they didn't work, and I got the same error over and over again. What can I do?

Upvotes: 2

Views: 7266

Answers (3)

Seifer
Seifer

Reputation: 257

Or just rake db:reset. That always works for me, when I get stuck.

Upvotes: 1

Jovica Šuša
Jovica Šuša

Reputation: 622

Your first try was close, you need to do

rake db:drop
rake db:create
rake db:schema:load

Check this article it may be helpful. http://icebergist.com/posts/rake-db-migrate-vs-rake-db-schema-load/

Upvotes: 7

Fran Martinez
Fran Martinez

Reputation: 3052

$ rm db/schema.rb
$ bundle exec rake db:drop
$ bundle exec rake db:create
$ bundle exec rake db:migrate

Upvotes: 1

Related Questions