lib/sequel_rails/configuration.rb in sequel-rails-0.5.0 vs lib/sequel_rails/configuration.rb in sequel-rails-0.5.1
- old
+ new
@@ -33,12 +33,20 @@
normalized[name] = normalize_repository_config(config)
normalized
end
end
+ def schema_dump
+ super.nil? ? (schema_dump = default_schema_dump) : super
+ end
+
private
+ def default_schema_dump
+ not %w(test production).include? Rails.env
+ end
+
def initialize(root, database_yml_hash)
super()
@root, @raw = root, database_yml_hash
end
@@ -73,15 +81,20 @@
end
end
# override max connections if requested in app configuration
config['max_connections'] = max_connections if max_connections
+ config['search_path'] = search_path if search_path
# some adapters only support an url
if config['adapter'] && config['adapter'] =~ /^(jdbc|do):/
params = {}
config.each do |k, v|
next if ['adapter', 'host', 'port', 'database'].include?(k)
+ if k == 'search_path'
+ v = v.split(',').map &:strip unless v.is_a? Array
+ v = URI::escape(v.join(','))
+ end
params[k] = v
end
params_str = params.map { |k, v| "#{k}=#{v}" }.join('&')
port = config['port'] ? ":#{config['port']}" : ''
config['url'] = case config['adapter']