Created
May 29, 2013 12:49
-
-
Save kangjoonsoo/5670033 to your computer and use it in GitHub Desktop.
rake db:drop db:create db:migrate db:seed
=> rake db:rebuild
This file contains hidden or 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 "Drop, create, migrate then seed the database" | |
| task :rebuild => :environment do | |
| Rake::Task['db:drop'].invoke | |
| Rake::Task['db:create'].invoke | |
| Rake::Task['db:migrate'].invoke | |
| Rake::Task['db:seed'].invoke | |
| end | |
| namespace :rebuild do | |
| desc "Drop, create, migrate the database with RAILS_ENV=test" | |
| task :test => :environment do | |
| Rails.env = 'test' | |
| Rake::Task['db:drop'].invoke | |
| Rake::Task['db:create'].invoke | |
| Rake::Task['db:migrate'].invoke | |
| end | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks to http://www.mfoot.com/blog/2012/05/26/custom-rake-tasks-for-dbdrop-dbcreate-dbmigrate-dbseed/