lib/hanami/model/migrator/connection.rb in hanami-model-1.0.0.beta1 vs lib/hanami/model/migrator/connection.rb in hanami-model-1.0.0.beta2
- old
+ new
@@ -32,21 +32,21 @@
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def host
- @host ||= parsed_uri.host
+ @host ||= parsed_uri.host || parsed_opt('host')
end
# Returns DB connection port
#
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def port
- @port ||= parsed_uri.port
+ @port ||= parsed_uri.port || parsed_opt('port').to_i.nonzero?
end
# Returns DB name from conenction
#
# Even when adapter doesn't provide it explicitly it tries to parse
@@ -81,20 +81,20 @@
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def user
- @user ||= parsed_opt('user')
+ @user ||= parsed_opt('user') || parsed_uri.user
end
# Returns user from DB connection
#
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def password
- @password ||= parsed_opt('password')
+ @password ||= parsed_opt('password') || parsed_uri.password
end
# Returns DB connection URI directly from adapter
#
# @since 0.5.0