Created
September 9, 2010 18:10
-
-
Save trshafer/572253 to your computer and use it in GitHub Desktop.
Database Branches
This file contains 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
## 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 %> |
This file contains 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
$ 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