5

我正在尝试将本地 Postgres 数据库推送到我的 Heroku 应用程序,并按照 Heroku 指南进行操作,heroku db:push但出现以下错误:

leonsas@leonsas-VirtualBox:~$ heroku db:push
 !    Taps Load Error: cannot load such file -- sqlite3
 !    You may need to install or update the taps gem to use db commands.
 !    On most systems this will be:
 !    
 !    sudo gem install taps

我已经试过了sudo gem install tapssudo gem install sqlite3但我不能让它工作。有什么想法为什么在我使用 postgres 时尝试加载 sqlite3 db?

4

1 回答 1

14

在 postgres 实例之间迁移数据时,不再推荐使用 Taps 工具。请改为尝试heroku-pg-transfer 。

这仅在您使用生产数据库之一或新的Heroku postgres 开发计划时才有效。如果您仍在使用旧的共享数据库计划,我建议您切换到新的开发计划。

首先,在 Heroku 上找到您的数据库的 URL:

$ heroku config:get DATABASE_URL
postgres://yada:yada@ec2-107-21-122-141.compute-1.amazonaws.com:5432/123

然后从本地数据库转移到 heroku 数据库:

$ heroku plugins:install https://github.com/ddollar/heroku-pg-transfer
$ heroku pg:transfer -f postgres://localhost/dbname -t postgres://yada:yada@ec2.../123

由于 heroku-pg-transfer 工具利用了 postgres 的本机 pg_dump 工具,它是一个更具可预测性和弹性的工具。

于 2012-06-21T01:10:00.440 回答