mirror of
https://github.com/github/rails.git
synced 2026-04-04 03:00:58 -04:00
Added option :schema_order to the PostgreSQL adapter to support the use of multiple schemas per database #697 [YuriSchimke]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@755 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -24,15 +24,21 @@ module ActiveRecord
|
||||
username = config[:username].to_s
|
||||
password = config[:password].to_s
|
||||
|
||||
schema_order = config[:schema_order]
|
||||
|
||||
if config.has_key?(:database)
|
||||
database = config[:database]
|
||||
else
|
||||
raise ArgumentError, "No database specified. Missing argument: database."
|
||||
end
|
||||
|
||||
ConnectionAdapters::PostgreSQLAdapter.new(
|
||||
pga = ConnectionAdapters::PostgreSQLAdapter.new(
|
||||
PGconn.connect(host, port, "", "", database, username, password), logger
|
||||
)
|
||||
|
||||
pga.execute("SET search_path TO #{schema_order}") if schema_order
|
||||
|
||||
pga
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user