Migrate Postgres from Heroku to Railway
I'm trying to migrate my postgres database from Heroku to Railway.
I already have a
dump
file from Heroku.
I'm following this guide to restore the database: https://blog.railway.app/p/postgre-backup#restoring-your-database-backup
However, when I run the command:
I get the following error:
Pls note:
- I've tried running this command on both Windows and Ubuntu, still I get the same error
- The dump file was created before Heroku removed the free tier. So now, I can't create a new dump file since heroku has deleted my dataRailway Blog
How to Backup and Restore Your Postgres Database
In this post, we will go over the process of backing up and restoring your Postgres database hosted on Railway.
Solution:Jump to solution
it looks like heroku has provided a pg_restore command that will work with it's dump files
https://devcenter.heroku.com/articles/heroku-postgres-import-export
just substitute for your database credentials from railway...
11 Replies
Project ID:
3bf60097-8588-44db-8386-146da476727f
3bf60097-8588-44db-8386-146da476727f
how do you know the dump file you have is not corrupted?
I don't...so this means that the file is corrupted?
Is there any possibility to migrate then?
I actually have a dump of all my projects which I had on Heroku previously.
I tried running the command on those different dump files as well. But they also show the same error...
i mean I'd look into ways to check if that file is corrupt.
but are you using the pg_restore tool that was released at the same time the pg_dump tool you used was released?
I didn't use pg_dump for creating the dump, I directly used the heroku command, as said here: https://devcenter.heroku.com/articles/heroku-postgres-import-export#capture-and-download-backup-with-pgbackups
are you using the correct flags on pg_restore to restore the type of dump file you took?
oh yeah interesting, what format does that provide the dump in? I highly doubt your dump files are corrupted, they're just not in the format that pg_restore expects
it exports in
.dump
format, so my file name is like: latest.dump
Solution
it looks like heroku has provided a pg_restore command that will work with it's dump files
https://devcenter.heroku.com/articles/heroku-postgres-import-export
just substitute for your database credentials from railway
It worked, Thank you so much for your time and help!! π
glad it worked! π