Created
May 30, 2013 03:04
-
-
Save lengarvey/5675496 to your computer and use it in GitHub Desktop.
Example database.yml that has different database per git branch
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
development: | |
adapter: postgresql | |
<% if `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '').gsub(/\W/, '_') =~ /hotfix|release/ %> | |
database: YOUR_APP_NAME_HERE_development_master <% else %> | |
database: YOUR_APP_NAME_HERE_development_<%= `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '').gsub(/\W/, '_')[0..20] %> <% end %> | |
pool: 5 | |
timeout: 5000 | |
host: localhost | |
test: | |
adapter: postgresql | |
<% if `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '').gsub(/\W/, '_') =~ /hotfix|release/ %> | |
database: YOUR_APP_NAME_HERE_test_master | |
<% else %> | |
database: YOUR_APP_NAME_HERE_test_<%= `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '').gsub(/\W/, '_')[0..20] %> | |
<% end %> | |
pool: 5 | |
timeout: 5000 | |
host: localhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment