# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
#
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: <%= ENV['USER'] %>
# min_messages: warning
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
development:
<<: *default
database: <%= `echo $(basename $PWD)_development` %>
test:
<<: *default
database: <%= `echo $(basename $PWD)_test` %>
production:
<<: *default
database: <%= `echo $(basename $PWD)_production` %>
Defaults
username is $USER, password is blank (it is default in homebrew installation)
database is based on application directory name with appripriate suffix
Reasoning
Usually these values are default for development environment
In production environment you replace database.yml anyway (both heroku and capistrano)
Database names shoud be distinct between applications and environments, but the actual names doesn't really matter.
It removes unnecessary step of database.yml setup when cloning app.
Using these defaults you can finally add database.yml to repository and ommit database.yml.example file.
Possible downsides
You want to use different username / password / database names for development environment. I can't think of reason why though. If you really want to to this, you can use --assume-unchanged feature of Git.
Defaults
username
is$USER
, password is blank (it is default in homebrew installation)database
is based on application directory name with appripriate suffixReasoning
database.yml.example
file.Possible downsides
--assume-unchanged
feature of Git.