Skip to content

Instantly share code, notes, and snippets.

@nthj
Created May 23, 2014 15:03
Show Gist options
  • Save nthj/b59d5c2cc8f3ef868243 to your computer and use it in GitHub Desktop.
Save nthj/b59d5c2cc8f3ef868243 to your computer and use it in GitHub Desktop.
Automatically create a new database for each of your development branches
#!/bin/bash
set -e
printf '\npost-checkout hook\n\n'
if [[ $3 == 1 ]]; then
echo "Creating `git name-rev --name-only $2`"
createdb "ticketbud_`git name-rev --name-only $2`_development"
createdb "ticketbud_`git name-rev --name-only $2`_test"
rake db:abort_if_pending_migrations || rake db:schema:load
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment