Merge PR #42840
This commit is contained in:
commit
b2db4c78a4
@ -1,3 +1,20 @@
|
||||
* Allow configuring Postgres password through the socket URL.
|
||||
|
||||
For example:
|
||||
```ruby
|
||||
ActiveRecord::DatabaseConfigurations::UrlConfig.new(
|
||||
:production, :production, 'postgres:///?user=user&password=secret&dbname=app', {}
|
||||
).configuration_hash
|
||||
```
|
||||
|
||||
will now return,
|
||||
|
||||
```ruby
|
||||
{ :user=>"user", :password=>"secret", :dbname=>"app", :adapter=>"postgresql" }
|
||||
```
|
||||
|
||||
*Abeid Ahmed*
|
||||
|
||||
* PostgreSQL: support custom enum types
|
||||
|
||||
In migrations, use `create_enum` to add a new enum type, and `t.enum` to add a column.
|
||||
|
@ -67,7 +67,7 @@ def raw_config
|
||||
database: uri.opaque
|
||||
)
|
||||
else
|
||||
query_hash.merge(
|
||||
query_hash.reverse_merge(
|
||||
adapter: @adapter,
|
||||
username: uri.user,
|
||||
password: uri.password,
|
||||
|
@ -62,6 +62,18 @@ def test_url_sub_key_merges_correctly
|
||||
}, pool_config.configuration_hash)
|
||||
end
|
||||
|
||||
def test_url_sub_key_merges_correctly_when_query_param
|
||||
hash = { "url" => "abstract:///?user=user&password=passwd&dbname=app" }
|
||||
pool_config = resolve_db_config :production, "production" => hash
|
||||
|
||||
assert_equal({
|
||||
adapter: "abstract",
|
||||
user: "user",
|
||||
password: "passwd",
|
||||
dbname: "app"
|
||||
}, pool_config.configuration_hash)
|
||||
end
|
||||
|
||||
def test_url_host_no_db
|
||||
pool_config = resolve_db_config "abstract://foo?encoding=utf8"
|
||||
assert_equal({
|
||||
|
Loading…
Reference in New Issue
Block a user