Skip to content

Instantly share code, notes, and snippets.

@semikolon
Forked from henrik/database.yml
Created July 15, 2009 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semikolon/147800 to your computer and use it in GitHub Desktop.
Save semikolon/147800 to your computer and use it in GitHub Desktop.
shared: &shared
# Use different adapters with JRuby vs. MRI
adapter: <%= defined?(JRuby) ? "jdbcmysql" : "mysql" %>
encoding: utf8
username: root
password:
host: localhost
socket: /opt/local/var/run/mysql5/mysqld.sock
<%
# For the git branches listed in DB_BRANCHES, use a dev DB with the same name.
# For other branches, use the DEFAULT_DB.
DEFAULT_DB = 'myproject_dev'
DB_BRANCHES = %w[ t123 t456 ]
branch = `git symbolic-ref HEAD 2> /dev/null`.chomp.split('/').last
dev_db = DB_BRANCHES.include?(branch) ? branch : DEFAULT_DB
puts "Using dev database: #{dev_db.inspect}"
%>
development:
<<: *shared
database: <%= dev_db %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment