Skip to content

Instantly share code, notes, and snippets.

@epochwolf
Created February 8, 2011 03:23
Show Gist options
  • Save epochwolf/815790 to your computer and use it in GitHub Desktop.
Save epochwolf/815790 to your computer and use it in GitHub Desktop.
db:genesis Drop in lib/tasks in a rails application for great justice
namespace :db do
desc "[CUSTOM] Nuke the database, run all migrates on a new database, and reseed."
task :genesis do
# McCoy: Dear Lord. You think we're intelligent enough to... suppose... what if this thing were used where data already exists?
Rake::Task['db:drop'].invoke
# Spock: It would destroy such data in favor of its new schema.
Rake::Task['db:create'].invoke
# McCoy: Its "new schema"? Do you have any idea what you're saying?
Rake::Task['db:migrate'].invoke
# Spock: I was not attempting to evaluate its moral implications, Doctor. As a matter of cosmic history, it has always been easier to destroy than to create.
Rake::Task['db:seed'].invoke
end
end
@kfatehi
Copy link

kfatehi commented Feb 8, 2011

:]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment