Search code examples
rubyactiverecorddatabase-migrationrails-migrations

Rollback all the migrations in ActiveRecord


How can I delete / rollback all the migrations that have been run without having to drop and setup the database

rake db:rollback

goes back just one version. How can I get it to go all the way ?


Solution

  • One way is :

    rake db:rollback STEP=10000000 
    

    Which pretty much means hacking your way back so many steps that the migration always goes to step 0. Another way is:

      rake db:migrate VERSION=0
    

    More references here.