I have this little Rake task which I seem to end up putting into all
of my projects and I'm wondering if this might be of use to other
people as well or if there is a better way of accomplishing this.
It is especially useful during initial development when you may hose
your migrations and need to go back to fresh db where rake db:migrate
VERSION=0 will not work (because of a failure during an up migration
leaving your database in an inconsistent state).
Anyhow, here's the task. I put it in lib/tasks/database.rake and then
type rake db:recreate
namespace :db do
desc "Drop and create the current database"
task :recreate => :environment do
abcs = ActiveRecord::Base.configurations