This commit is contained in:
Rafael Mendonça França 2021-09-22 18:11:40 -04:00
commit b2db4c78a4
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
3 changed files with 30 additions and 1 deletions

@ -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({