Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 382
AdamT Avatar asked Nov 20 '11 00:11

AdamT


1 Answers

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.

like image 81
Sean Hill Avatar answered Sep 18 '22 14:09

Sean Hill