Have gone through different solutions available on stackoverflow
and also on different forums. But none addresses the precise problem.
As per the documentation: https://devcenter.heroku.com/articles/heroku-postgres-import-export
I have the dump
file created from my local database, with this command:
pg_dump -Fc --no-acl --no-owner -h localhost -U postgres dss_iaya>dss_iaya_db_dump1.dump
Then as per documentation, uploaded to a server with public access URL: https://firebasestorage.googleapis.com/v0/b/iaya-664f3.appspot.com/o/dss_iaya_db_dump1.dump?alt=media&token=06167d04-1e98-4e4b-b0e0-9d83a86dd167
Now when I try to restore on Heroku
as per its documentation syntax heroku pg:backups:restore [BACKUP] [DATABASE] --app APP
using following command, it returns error message when restoring.
heroku pg:backups:restore --app heroku-postgres-*** 'https://firebasestorage.***/dss_iaya_db_dump1.dump?alt=media&token=***' 'postgres://quesu***:I***@ec2-54-***.eu-west-1.compute.amazonaws.com:5432/d3n***k0'
I have used *** for security purpose only, as can not mention full credentials. But I believe one can understand the whole syntax.
When I restore same .dump
file on a newly created local database it works without any issues and creates/restores the whole database with tables and data.
In logs you see dump size: 0 Bytes. Also you see aborting and 403, so if you check your file: https://llfirebasestorage.googleapis.com/vo/b/iaya-664f3.appspot.com/0/dss_iaya_db_dump1.dump?a1t=media
you get:
Just found the solution, actually two things were wrong in my case.
One, the uploaded
.dump
file was not well readable/usable by theheroku
.Two, the
heroku postgresql DB
complete URL was not required to be provided.After typing this command, I was asked to retype the
heroku
app name just to confirm the operation. Once done, everything worked like a charm.