我正在尝试将我的生产Heroku数据库导入我的开发机器.
我的本地数据库是PostgreSQL.
首先,我将转储从Heroku导出到我的机器
curl -o latest.dump `heroku pgbackups:url`
Run Code Online (Sandbox Code Playgroud)
然后,我尝试删除本地数据库,rake db:drop然后使用再次创建空数据库rake db:create.
我得到的问题是实际尝试将转储导入数据库
psql -d app_development -U myusername -f mydumpfile.sql
Run Code Online (Sandbox Code Playgroud)
我开始看到这样的错误
psql:latest.dump:24: ERROR: syntax error at or near "PGDMP"
LINE 1: PGDMP
^
psql:latest.dump:28: ERROR: syntax error at or near ""
LINE 1: INCREMENT BY 1
^
psql:latest.dump:36: ERROR: syntax error at or near ""
LINE 1: id integer NOT NULL,
^
psql:latest.dump:40: ERROR: syntax error at or near ""
LINE 1: INCREMENT BY 1
^
psql:latest.dump:45: …Run Code Online (Sandbox Code Playgroud)