Created
February 8, 2011 03:23
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:]