I found the essence of database.yml examples using mysql, postgres and sqlite3, and the Rails 3.2 source code for connection adapters also gives a good idea.
Considers the following most commonly used options:
- Adapter
- Encoding
- Database
- swimming pool
- Username
- password
- socket
- host
- Port
- Time-out
The Rails 3.2 connection_specification.rb file looks like it simply combines any parameters that you include, so I would say which options you include on the database adapter that you decide to use (lines 58-74):
def connection_url_to_hash(url) # :nodoc: config = URI.parse url adapter = config.scheme adapter = "postgresql" if adapter == "postgres" spec = { :adapter => adapter, :username => config.user, :password => config.password, :port => config.port, :database => config.path.sub(%r{^/},""), :host => config.host } spec.reject!{ |_,value| !value } if config.query options = Hash[config.query.split("&").map{ |pair| pair.split("=") }].symbolize_keys spec.merge!(options) end spec end
source share