简体   繁体   English

在 Heroku 中复制 Postgres 数据库时出错

[英]Error copying Postgres database in Heroku

I've been using the same command to copy my Heroku Postgres database from my production environment to my development without a hitch, until today:我一直在使用相同的命令将我的 Heroku Postgres 数据库从我的生产环境顺利复制到我的开发中,直到今天:

heroku pg:copy <production-app>::DATABASE DATABASE --app <development-app>

Starting copy of DATABASE to DATABASE... done
Copying... !
 ▸    An error occurred and the backup did not finish.
 ▸
 ▸
 ▸    pg_restore: warning: errors ignored on restore: 36
 ▸    pg_restore finished with errors
 ▸    waiting for pg_dump to complete
 ▸    pg_dump finished successfully
 ▸
 ▸    Run heroku pg:backups:info <redacted> for more details.

Then if I run the command for more details, I get:然后,如果我运行命令以获取更多详细信息,我会得到:

▸    Not found.

Probably not a solution because it didn't fully work for me, but possibly a place to start.可能不是一个解决方案,因为它并不完全适合我,但可能是一个开始的地方。

Rather than use pg:copy , I tried to break it into a few steps.我没有使用pg:copy ,而是尝试将其分解为几个步骤。

First, I did a dump from the source database:首先,我从源数据库进行了转储:

pg_dump -O -f dumpfile.sql $(heroku config:get DATABASE_URL -a <my-app>

Next, I manually edited the file.接下来,我手动编辑了文件。 I changed:我变了:

CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public; to

CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA heroku_ext;

and I replaced any references to public.citext with heroku_ext.citext .我用heroku_ext.citext替换了对public.citext的任何引用。

Last, I loaded the edited dump file:最后,我加载了编辑后的转储文件:

psql $(heroku config:get HEROKU_POSTGRESQL_COLOR_URL -a <my-app>) < dumpfile.sql

It didn't fail in the same way as pg:copy but there were other errors that prevented my app from running properly.它并没有以与pg:copy相同的方式失败,但是还有其他错误阻止了我的应用程序正常运行。 I haven't yet had the chance to dig deeper.我还没有机会深入挖掘。

I have the same issue.我有同样的问题。 3 days ago it's works well, but now I receive error. 3天前它运作良好,但现在我收到错误。 Like Heroku something chang像 Heroku 东西 chang

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM