简体   繁体   English

为什么Heroku不下载带有“ Heroku db:pull”的数据库更新?

[英]why Heroku does not download database updates with 'Heroku db: pull'?

I have run 'heroku db:push' to download heroku db updates, it show me error: 我已经运行“ heroku db:push”来下载heroku db更新,它显示了错误:

taps load error: no such file to load --sqlite3 点击加载错误:没有要加载的此类文件--sqlite3
you may need to install or update the taps gem to use db commands. 您可能需要安装或更新taps gem才能使用db命令。
on most systems this will be: 在大多数系统上,这将是:
sudo gem install taps sudo gem安装水龙头

I have installed heroku 2.25.0, taps 0.3.24 and I changed the Gemfile replacing gem sqlite3 with: 我已经安装了heroku 2.25.0,点击了0.3.24,我更改了Gemfile,将gem sqlite3替换为:

group :development, :test do 小组:发展,:测试
gem 'sqlite3' gem'sqlite3'
end 结束
group :production do 小组:生产做
gem 'pg' 宝石'pg'
end 结束

I think it's a problem of compatibility database between sqlite e postgresql. 我认为这是sqlite e postgresql之间的数据库兼容性问题。

is it possible? 可能吗? Or what can be ? 或者是什么?

First, make sure you've got your gems all up to date by running bundle install . 首先,通过运行bundle install确保您的gem是最新的。 It won't hurt if everything's fine so you may as well make sure. 如果一切正常,它不会有任何伤害,因此您可以确保。

After that, you should be able to use db:pull to pull a copy to your local machine using the snippet that follows: 之后,您应该能够使用db:pull通过以下代码片段将副本db:pull至本地计算机:

bundle exec heroku db:pull sqlite://local.db --app my_app

If this doesn't work for some reason, you can just change your Gemfile while pulling the database down -- and then you can change it back if you want to. 如果由于某种原因该方法不起作用,则可以在拉下数据库的同时更改Gemfile -然后可以根据需要将其更改回原来的状态。

group :development, :test do
  gem 'sqlite3'
  # add this next line and run 'bundle install' until you get db:pull to work
  gem 'pg'
end
group :production do
  gem 'pg'
end

(I believe this will work, though I personally haven't tried it. Please respond if there's an issue.) (尽管我个人还没有尝试过,但我相信这会奏效。如果有问题,请回复。)

Finally, there are some issues pulling and pushing databases if you're running ruby 1.9.3 on your local machine -- but it's only if you're doing a db:push . 最后,如果您在本地计算机上运行ruby 1.9.3 ,则在拉入和推入数据库时​​会遇到一些问题-但是仅当您在执行db:push时才如此。 If you have problems with that here's a link to the solution. 如果您对此有疑问,请访问以下链接。

When you run the heroku command, it runs locally on your development machine. 当您运行heroku命令时,它在开发计算机上本地运行。 So the development group of your Gemfile is used: 因此,使用了Gemfile的development组:

group :development, :test do
  gem 'sqlite3'
end

Since it contains sqlite3 , you need the sqlite3 gem to be installed on your development machine. 由于它包含sqlite3 ,因此您需要在开发机器上安装sqlite3 gem。 Have you run bundle install to install this gem locally? 您是否运行过bundle install在本地安装此gem? And you may need to run the heroku command within a bundle exec call to make sure the gems are loaded: 您可能需要在bundle exec调用中运行heroku命令,以确保已加载gem:

bundle exec heroku db:pull . bundle exec heroku db:pull

Finally, if you want to download Heroku DB, you should use db:pull , not db:push . 最后,如果要下载Heroku DB,则应使用db:pull而不是db:push

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

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