如何仅使用 heroku 上的 postgres 转储来恢复我的数据库数据

问题描述

我达到了我的 heroku 应用程序的构建限制,但我仍然想进行很多更改,我想出了创建另一个应用程序并使用与第一个应用程序相同的数据库然后删除一个应用程序的困难并将我创建的第二个应用程序重命名为已删除的第一个应用程序的名称,但是当我删除一个应用程序时,我遇到了一个问题数据库也被删除,但在删除该应用程序之前我下载了 postgres 转储以进行备份,所以现在我将它上传到我的 github 中恢复我的数据。

现在我正在运行以下命令

heroku pg:backups:restore 'https://github.com/myusername/repo/path/branch/latest.dump' --app myappname --c
onfirm myappname

但我收到以下错误

Restoring... !
 !    An error occurred and the backup did not finish.
 !
 !    waiting for restore to complete
 !    pg_restore finished with errors
 !    waiting for download to complete
 !    download finished with errors
 !    please check the source URL and ensure it is publicly accessible
 !

所以我想知道是否有什么我可以做的来执行备份,或者我只是浪费了,真的需要你的帮助

提前致谢

解决方法

您使用了错误的 URL 来指向转储文件,

https://github.com/myusername/repo/path/branch/latest.dump 是一个 blob_url,它类似于网页的 URL,我们通过访问 blob_url 获得文件的呈现 HTML 版本。

您应该使用 raw_url 指向哑文件,以获取 raw_url 点击相关文件的 blob 页面上的 Raw 按钮

github get raw file link

希望应该可行