Search code examples
ruby-on-railsrubyruby-on-rails-3migrationmodels

Roll back all rails migrations or drop tables and modify migrations (start from scratch)


I'm new to Rails and have started a project that I'm unhappy with my models and db schema.

I'd like to start again from scratch but keep all my views, controllers.

What's the best way to go about doing this?

I want to remove all my migrations and all my models. There should be no irrelevant files left after this process (like migrations that are no longer in use).

If it helps, I'm using Rails 3.1

Thanks!


Solution

  • First, rollback your migrations to version 0.

    rake db:migrate VERSION=0
    

    Then you manually delete your migrations and models, leaving the controllers and views intact.