# File lib/heroku/commands/pg.rb, line 101
    def promote
      db_id = extract_option("--db")
      url = config_vars[db_id]
      abort(" !   Usage: heroku pg:promote --db <DATABASE>") unless url

      # look up the true name of the database, avoiding "DATABASE_URL" unless it's the only option
      name = config_vars.reject { |(var, val)| var == "DATABASE_URL" }.invert[url] || "DATABASE_URL"

      if db_id == "DATABASE_URL"
        abort(" !  Promoting DATABASE_URL to DATABASE_URL has no effect.")
        return
      end

      abort(" !   DATABASE_URL is already set to #{name}.") if url == config_vars["DATABASE_URL"]

      display "Setting config variable DATABASE_URL to #{name}", false
      return unless confirm_command
      display "... "

      heroku.add_config_vars(app, {"DATABASE_URL" => url})

      display "done"

      display "DATABASE_URL (#{name})     => #{url}"
      display ""
    end