Created
April 5, 2011 00:47
-
-
Save tjmcewan/902802 to your computer and use it in GitHub Desktop.
Rails agnostic database.yml
This file contains hidden or 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
<% | |
app = "awesome_application" | |
mysql_version = case Rails.version.first.to_i | |
when 3 then 'mysql2' | |
when 2 then 'mysql' | |
else | |
raise 'Version not supported' | |
end | |
%> | |
defaults: &defaults | |
adapter: <%= mysql_version %> | |
encoding: utf8 | |
reconnect: false | |
pool: 5 | |
username: root | |
password: | |
host: localhost | |
development: | |
database: <%= app + "_dev" %> | |
<<: *defaults | |
test: | |
database: <%= app + "_test" %> | |
<<: *defaults | |
production: | |
database: <%= app + "_dev" %> | |
<<: *defaults |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GOTCHA:
heroku db:pull
(Taps) doesn't parse the ERB so if you're using this w/ Heroku you'll have to put the dev db name in normally.