Heroku pg:pull failing to populate schema

你。 提交于 2019-11-29 07:48:13

I wrote the pg:pull and pg:push commands.

pg:pull and pg:push both use the pg_dump command and pipe that directly to pg_restore (source code). Unfortunately, there are problems with pg:push,pull on windows as of the time of this answer, September 2014. These problems are not insurmountable, so if you are coming to this answer sometime later, please check to see if it might have been fixed.

The env command used here and here I don't think is on windows, which is why you're having to do the PGUSER and PGPASSWORD stuff. However the reason for the env is that pg_dump needs different environment variables than pg_restore.

I took a stab at fixing that once, by using popen to set up the commands independently, then wire them together instead of using a pipe. However, I couldn't quite get it working, and had to stop.

I'd be very happy to review any patches that go all the way and fix this issue, just @ mention me on a pull request to the heroku/heroku project.

Sorry for my failing to fix this issue :(

Instead, and until this is fixed, you can use the pg_dump and pg_restore commands separately, directly. It's more cumbersome as a 2 step process, and having to look up the remote credentials, but it would get the job done. The linked source in the gen_pg_*_command methods show how to use pg_dump and pg_restore.

The answer of @will is perfect in case of regular Heroku development, but fail in case of Private Space. As mentioned at Heroku Postgres and Heroku Private Spaces :: External connections:

Unlike the Heroku Postgres databases in our hobby, standard, and premium tiers, private databases cannot be accessed via a local computer.

As a workaround, you may duplicate the DB to non private DB, and then you can dump the DB your local comp.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!