Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Rake Remigrate

DZone's Guide to

Rake Remigrate

·
Free Resource
From http://errtheblog.com/post/3
Drops your database, recreates it, runs all migrations, then loads fixtures.  Heroic.


desc "Drop then recreate the dev database, migrate up, and load fixtures" 
task :remigrate => :environment do
  return unless %w[development test staging].include? RAILS_ENV
  ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
  Rake::Task[:migrate].invoke
  Rake::Task["db:fixtures:load"].invoke
end
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}