PostgreSQL database import

I would like to migrate my local PostgreSQL database to the deployed PostgreSQL database on What should I do?

How about pg_dump & pg_restore?

(Untested. Based on Migrate from Heroku · Fly Docs)

  1. On your computer, create a DB dump:

    pg_dump -Fc --no-acl --no-owner YOUR_DATABASE > db.dump
  2. Upload the dump to the VM:

    fly ssh sftp shell
    put db.dump /tmp/db.dump

    then exit out of the SFTP shell.

  3. SSH into the VM and load the dump:

    fly ssh console
    pg_restore --verbose --clean --no-acl --no-owner -d "$DATABASE_URL" /tmp/db.dump

Thanks it useful

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.