2015-11-09 9 views
6

Ich habe gerade festgestellt, dass die reconnect: true Konfigurationsoption in der database.yml Datei möglich ist. Welche anderen Konfigurationsmöglichkeiten gibt es? Gibt es eine vollständige Referenz für alle Optionen?Was sind alle möglichen Schlüssel für database.yml

Bekannte wichtige Beispiele:

default: &default 
    adapter: mysql2 
    encoding: utf8 
    pool: 5 
    username: foo 
    password: bar 
    reconnect: true 
    socket: /var/sock/thing.sock 

development: 
    <<: *default 
    database: app_development 

Antwort

8

Ich glaube nicht, gibt es einen Ort, der sie nur auflistet, aber ich überprüfte den ConnectionAdapaters des Active. Beachten Sie, dass die Optionen die von Ihnen verwendete Datenbank ändern, diese wurde jedoch im MySQL-Verbindungsadapter aufgeführt.

Liste der Optionen für MySQL

:host - Defaults to "localhost". 
:port - Defaults to 3306. 
:socket - Defaults to "/tmp/mysql.sock". 
:username - Defaults to "root" 
:password - Defaults to nothing. 
:database - The name of the database. No default, must be provided. 
:encoding - (Optional) Sets the client encoding by executing "SET NAMES <encoding>" after connection. 
:reconnect - Defaults to false (See MySQL documentation: http://dev.mysql.com/doc/refman/5.7/en/auto-reconnect.html). 
:strict - Defaults to true. Enable STRICT_ALL_TABLES. (See MySQL documentation: http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html) 
:variables - (Optional) A hash session variables to send as SET @@SESSION.key = value on each database connection. Use the value +:default+ to set a variable to its DEFAULT value. (See MySQL documentation: http://dev.mysql.com/doc/refman/5.7/en/set-statement.html). 
:sslca - Necessary to use MySQL with an SSL connection. 
:sslkey - Necessary to use MySQL with an SSL connection. 
:sslcert - Necessary to use MySQL with an SSL connection. 
:sslcapath - Necessary to use MySQL with an SSL connection. 
:sslcipher - Necessary to use MySQL with an SSL connection. 

Die Github für Rails Active Adapter, https://github.com/rails/rails/tree/master/activerecord/lib/active_record/connection_adapters

Verwandte Themen