-
-
Save rubyonrailsworks/3924306 to your computer and use it in GitHub Desktop.
ERB template for git-branch aware database.yml (development/test only)
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
<% | |
# if you need to work on a branch with a different schema, use | |
# git config --bool branch.the-new-branch.database true | |
# 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}" : "" | |
%> | |
common: &common | |
adapter: mysql2 | |
encoding: utf8 | |
reconnect: false | |
pool: 5 | |
username: root | |
development: | |
<<: *common | |
database: app_dev<%= suffix %> | |
test: | |
<<: *common | |
database: app_test<%= suffix %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment