-
-
Save ang3lkar/b369d02655ff7b5a52ec to your computer and use it in GitHub Desktop.
One Database Per Branch, Per Environment
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
CURRENT_BRANCH = `git status | head -1`.to_s.gsub('On branch ','').chomp |
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_prefix = 'workable' | |
environments = %W( development test ) | |
%> | |
defaults: &defaults | |
pool: 5 | |
adapter: mysql2 | |
encoding: utf8 | |
reconnect: false | |
username: root | |
password: | |
host: localhost | |
<% environments.each do |environment| %> | |
<%= environment %>: | |
<<: *defaults | |
database: <%= [ database_prefix, CURRENT_BRANCH ].join('_').underscore %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment