Created
September 9, 2014 16:10
-
-
Save sao/5683feb4af2e2c1d4841 to your computer and use it in GitHub Desktop.
Dynamic database names on git checkout.
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
# | |
# requires 'gem install git' | |
# | |
<% | |
current_branch = Git.open('.').current_branch | |
unless current_branch =~ /(master|rebasing)/ | |
branch = "_#{current_branch}" | |
end | |
%> | |
development: | |
adapter: postgresql | |
encoding: unicode | |
database: workstiming_development<%= branch %> | |
host: localhost | |
pool: 5 | |
username: aisdata | |
password: wRew2pheheGE | |
test: | |
adapter: postgresql | |
encoding: unicode | |
database: aisdata_test<%= branch %> | |
host: localhost | |
pool: 5 | |
username: aisdata | |
password: wRew2pheheGE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used in conjunction with my db helper so I can easily create a new database for each branch I work on.