Skip to content

Instantly share code, notes, and snippets.

@saimonmoore
Created February 22, 2012 09:29
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 saimonmoore/1883590 to your computer and use it in GitHub Desktop.
Save saimonmoore/1883590 to your computer and use it in GitHub Desktop.
Clear out your dev db (with protection from #epicfailure)
function cleardb {
DEVDB="`ruby -e "require 'yaml'; puts YAML.load(File.open('config/database.yml'))['development']['database']"`"
if [[ $DEVDB =~ "production" ]]; then
echo 'WATCHOUT! cleardb running against production dump';
else
bundle exec rake db:drop db:create db:schema:load db:seed && bundle exec rake db:test:clone;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment