# Transferring Postgres from Heroku

**URL:** <https://community.fly.io/t/transferring-postgres-from-heroku/6611>\
**Category:** Questions / Help\
**Created:** [August 27, 2022, 7:50am UTC](https://community.fly.io/t/transferring-postgres-from-heroku/6611 "2022-08-27T07:50:41Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![lortza](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/lortza/32/5615_2.png) [@lortza](https://community.fly.io/u/lortza)\
**Post date:** [October 17, 2022, 2:56pm UTC](https://community.fly.io/t/transferring-postgres-from-heroku/6611/21 "2022-10-17T14:56:58Z")

</div>

Cross-posting this for people following this thread. There is a new solution posted [here](https://community.fly.io/t/help-migrating-postgres-from-heroku-rails-app/7863/8) in the [Help migrating postgres from heroku rails app](https://community.fly.io/t/help-migrating-postgres-from-heroku-rails-app/7863) thread that uses the postgres `--data-only` flag.

---

<div class="post-metadata">

**Author:** ![sstrudeau](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@sstrudeau](https://community.fly.io/u/sstrudeau)\
**Post date:** [October 17, 2022, 3:31pm UTC](https://community.fly.io/t/transferring-postgres-from-heroku/6611/22 "2022-10-17T15:31:18Z")

</div>

Thanks, I’m going to tear everything down and start over from scratch this afternoon and see if I can get through the steps and avoid the version mismatch issue.

---

<div class="post-metadata">

**Author:** ![alexwebgr](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/alexwebgr/32/40540_2.png) [@alexwebgr](https://community.fly.io/u/alexwebgr)\
**Post date:** [February 4, 2023, 7:29am UTC](https://community.fly.io/t/transferring-postgres-from-heroku/6611/23 "2023-02-04T07:29:54Z")

</div>

i would like to post the command for importing a local db dump that worked for me 🙂

first i proxied with  
`fly proxy 15432:5432 -a app-db`

and then  
`pg_restore -U postgres -h localhost -p 15432 -W -d db_name -c < db.sql`

-W so it asks for the password

-c so it deletes the existing database so you don’t get ` for relation "db_table" already exists`

[Previous page](https://community.fly.io/t/transferring-postgres-from-heroku/6611.md?page=1)
