Search code examples
ruby-on-railsrubydeviserake

How do I run a migration again, without deleting all the newer migrations?


I had just installed devise so the table didn't have any data on it except one user (me).

I was re-doing the database all over again so I dropped it all. I did rails g scaffold to generate 6 new models and controllers and did rake db:migrate

In my /db/migrate directory I have the devise file with the filename 20130603211907_devise_create_users.rb

Here is the issue: If I do rake db:migrate:down VERSION=20130603211907 it will delete all the new migrations.

How do I run a migration again, without deleting all the newer migrations?


Solution

  • If you are developing locally and it wouldn't hurt to remove all data from your models you could simply drop your db and then create & migrate from scratch:

    Purge or recreate a Ruby on Rails database