use*_*745 5 postgresql ruby-on-rails heroku
我这样做了:
heroku pgbackups:capture
heroku pgbackups:url
downloaded file from url obtained from above result
Created psql db "abc"
Run Code Online (Sandbox Code Playgroud)
跑到这个当地的comamnd:
pg_restore --verbose --clean -no-acl --no-owner -U uname -d abc ~/Downloads/b001.dump
Run Code Online (Sandbox Code Playgroud)
输出:
pg_restore: connecting to database for restore
pg_restore: implied data-only restore
Run Code Online (Sandbox Code Playgroud)
我装了2路.首先创建db,然后直接运行pg_restore命令.然后没有创建表.
然后,认为转储只包含数据,我在新创建的数据库上运行迁移(意味着创建表结构)并运行pg_restore命令.但是表数据仍然是空的.
如果您完全按照编写的方式运行命令,则会出现错误:
你已经写了-no-acl而不是--no-acl正在得到-a这意味着:
-a, - data-only
Run Code Online (Sandbox Code Playgroud)Restore only the data, not the schema (data definitions).