lib/heroku/command/fork.rb
# fork [NEWNAME]
#
# Fork an existing app -- copy config vars and Heroku Postgres data, and re-provision add-ons to a new app.
# New app name should not be an existing app. The new app will be created as part of the forking process.
#
# -s, --stack  STACK   # specify a stack for the new app
# --region REGION      # specify a region
#
fork [NEWNAME]
Fork an existing app -- copy config vars and Heroku Postgres data, and re-provision add-ons to a new app.
New app name should not be an existing app. The new app will be created as part of the forking process.

s, --stack  STACK   # specify a stack for the new app
region REGION      # specify a region
fork [ NEWNAME ] Fork an existing app -- copy config vars and Heroku Postgres data and re - provision add - ons to a new app . New app name should not be an existing app . The new app will be created as part of the forking process . s -- stack STACK # specify a stack for the new app region REGION # specify a region
def migrate_db(from_addon, from, to_addon, to)
      transfer = nil
      action("Transferring database (this can take some time)") do
        from_config = api.get_config_vars(from).body
        from_attachment = from_addon["attachment_name"]
        to_config = api.get_config_vars(to).body
        to_attachment = to_addon["message"].match(/Attached as (\w+)_URL\n/)[1]
        pgb = Heroku::Client::Pgbackups.new(from_config["PGBACKUPS_URL"])
        transfer = pgb.create_transfer(
          from_config["#{from_attachment}_URL"],
          from_attachment,
          to_config["#{to_attachment}_URL"],
          to_attachment,
          :expire => "true")
        error transfer["errors"].values.flatten.join("\n") if transfer["errors"]
        loop do
          transfer = pgb.get_transfer(transfer["id"])
          error transfer["errors"].values.flatten.join("\n") if transfer["errors"]
          break if transfer["finished_at"]
          sleep 1
        end
        print " "
      end
    end
def migrate_db ( from_addon , from , to_addon , to ) transfer = nil action ( "Transferring database (this can take some time)" ) do from_config = api . get_config_vars ( from ) . body from_attachment = from_addon [ "attachment_name" ] to_config = api . get_config_vars ( to ) . body to_attachment = to_addon [ "message" ] . match ( / Attached as ( \w +)_URL \n / ) [ 1 ] pgb = Heroku :: Client :: Pgbackups . new ( from_config [ "PGBACKUPS_URL" ] ) transfer = pgb . create_transfer ( from_config [ "#{from_attachment}_URL" ] , from_attachment , to_config [ "#{to_attachment}_URL" ] , to_attachment , :expire => "true" ) error transfer [ "errors" ] . values . flatten . join ( "\n" ) if transfer [ "errors" ] loop do transfer = pgb . get_transfer ( transfer [ "id" ] ) error transfer [ "errors" ] . values . flatten . join ( "\n" ) if transfer [ "errors" ] break if transfer [ "finished_at" ] sleep 1 end print " " end end
fork [NEWNAME]
Fork an existing app -- copy config vars and Heroku Postgres data, and re-provision add-ons to a new app.
fork [ NEWNAME ] Fork an existing app -- copy config vars and Heroku Postgres data and re - provision add - ons to a new app .
from_addon
<not_specific>
from
<not_specific>
to_addon
<not_specific>
to
<not_specific>