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

18,792

Solution 1

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.

Solution 2

Just delete all files in app/models and db/migrate then run:

rake db:reset
Share:
18,792

Related videos on Youtube

AdamT
Author by

AdamT

Updated on June 04, 2022

Comments

  • AdamT
    AdamT about 2 years

    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!

  • equivalent8
    equivalent8 almost 10 years
    just watch out, this run seeds as well