Skip to content

Instantly share code, notes, and snippets.

@trshafer
Created September 9, 2010 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trshafer/572253 to your computer and use it in GitHub Desktop.
Save trshafer/572253 to your computer and use it in GitHub Desktop.
Database Branches
## database.yml (after)
<%
# http://mislav.uniqpath.com/rails/branching-the-database-along-with-your-code/
branch = `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '')
suffix = `git config --bool branch.#{branch}.database`.chomp == 'true' ? "_#{branch}" : ""
%>
development:
# ... adapter/auth config ...
database: myapp<%= suffix %>
$ git config --bool branch.my_feature.database true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment