title: Heroku transfer db from one app to another
body: <p>I need to transfer db from app_1 to app_2</p>
  
  <p>I created backup on app_1</p>
  
  <p>Then ran: </p>
  
  <p>heroku pg:backups restore HEROKU_POSTGRESQL_COLOR --app app_2 <code>heroku pgbackups:url --app app_1</code></p>
  
  <p>HEROKU_POSTGRESQL_COLOR = database URL for app_2</p>
  
  <p>Then I get: </p>
  
  <pre><code> !    `pg:backups` is not a heroku command.
   !    Perhaps you meant `pgbackups`.
   !    See `heroku help` for a list of available commands.
  </code></pre>
  
  <p>So I ran:</p>
  
  <p>heroku pgbackups:restore HEROKU_POSTGRESQL_COLOR --app app_2 <code>heroku pgbackups:url --app app_1</code></p>
  
  <p>Then I get the following: </p>
  
  <pre><code>!    WARNING: Destructive Action
  !    This command will affect the app: app_2
  !    To proceed, type "app_2" or re-run this command with --confirm app_2
  </code></pre>
  
  <p>So I confirmed with:</p>
  
  <pre><code>&gt; app_2
   !    Please add the pgbackups addon first via:
   !    heroku addons:add pgbackups
  </code></pre>
  
  <p>So then I ran: <code>heroku addons:add pgbackups --app app_2</code></p>
  
  <pre><code>Adding pgbackups on app_2... failed
   !    Add-on plan not found.
  </code></pre>
  
  <p>Is there a way around this issue? any help would be greatly appreciated! </p>
  
  <p><strong>* Solution *</strong></p>
  
  <p>I ended up emailing Heroku, they advised that I need to <code>heroku update; heroku plugins:update</code> but <code>heroku update</code> is only available to heroku toolbelt only and I had the gem installed. </p>
  
  <p>Solution: </p>
  
  <p>Install Heroku toolbelt <a href="https://toolbelt.heroku.com/">here</a></p>
  
  <p>Then uninstall the gem: </p>
  
  <pre><code>gem uninstall heroku --all
  </code></pre>
  
  <p>run the following to get the version and it should output <code>heroku-toolbelt</code>, instead of the gem, more info <a href="https://devcenter.heroku.com/articles/heroku-command">here</a></p>
  
  <pre><code>$ heroku --version
    heroku-toolbelt/2.39.0 (x86_64-darwin10.8.0) ruby/1.9.3
  </code></pre>
  
  <p>To copy the databases over:</p>
  
  <pre><code>heroku pg:backups restore `heroku pgbackups:url --app app_1` HEROKU_POSTGRESQL_COLOR --app app_2
  </code></pre>
  
  <p>But even better—you can copy directly from one database to another without needing the backup:</p>
  
  <p>Assuming app_2 database url is: <code>HEROKU_POSTGRESQL_GOLD</code></p>
  
  <pre><code>heroku pg:copy app_1::DATABASE_URL GOLD -a app_2 
  </code></pre>
  
  <p>That will copy the main database from app_1 to the GOLd database on app_2</p>