Skip to content

Instantly share code, notes, and snippets.

@jrhorn424
Created October 21, 2014 18:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrhorn424/2f9580290abe34603cf9 to your computer and use it in GitHub Desktop.
Save jrhorn424/2f9580290abe34603cf9 to your computer and use it in GitHub Desktop.
Simply drop your database and start again
# lib/tasks/db.rake
# execute me with rake db:nuke_pave
namespace :db do
desc "drops, creates, migrates, and seeds database"
unless Rails.env == "Production"
task :nuke_pave => %w(environment db:drop db:create db:migrate db:seed) do
# If you have a sample file that creates data for you to play with locally:
# Rake::Task["db:sample"].execute if Rails.env == "development"
puts "Nuke and pave of #{Rails.env} complete."
end
end
end
@johnelliott
Copy link

Thanks Jeff!

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