def parse_db_uri(db_uri)
      uri = URI.parse(db_uri)
    
      db_config = {
        :adapter => uri.scheme,
        :database => uri.path[1..-1],
        :host => uri.host
      }
    
      if uri.user
        db_config[:username] = uri.user
        db_config[:password] = uri.password if uri.password
      end
      db_config[:port] = uri.port if uri.port
    
      db_config
    end
def parse_db_uri(db_uri)
      uri = URI.parse(db_uri)
    
      db_config = {
        :adapter => uri.scheme,
        :database => uri.path[1..-1],
        :host => uri.host
      }
    
      if uri.user
        db_config[:username] = uri.user
        db_config[:password] = uri.password if uri.password
      end
      db_config[:port] = uri.port if uri.port
    
      db_config
    end
Parse a Heroku-style database URI and return an ActiveRecord configuration hash
 based on it.  Format is as follows:

   <adapter>://[<username>[:<password>]]@<host>[:<port>]/<database>