Skip to content

Instantly share code, notes, and snippets.

@ang3lkar
Forked from chuckbergeron/boot.rb
Last active September 8, 2015 16:04
Show Gist options
  • Save ang3lkar/b369d02655ff7b5a52ec to your computer and use it in GitHub Desktop.
Save ang3lkar/b369d02655ff7b5a52ec to your computer and use it in GitHub Desktop.
One Database Per Branch, Per Environment
CURRENT_BRANCH = `git status | head -1`.to_s.gsub('On branch ','').chomp
<%
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