简体   繁体   English

Heroku耙db:migrate不起作用

[英]Heroku rake db:migrate doesnt work

im having this issue when i try to deploy my ruby on rails application to heroku, i check different posts here, because i saw this issue before but i couldnt fix it. 当我尝试将我的Ruby on Rails应用程序部署到heroku时,我遇到了这个问题,我在这里检查了不同的帖子,因为我之前看过这个问题,但无法解决。 when i try to run: 当我尝试运行时:

$ heroku rake db:migrate

I get a lot of these ones: DEPRECATION WARNING : 我有很多这样的东西: DEPRECATION WARNING

and then: 接着:

rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)

Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)

I tried to change my Gemfile with 'pg' and my group :assets do to :production, i know im missing something but i could'nt figured out what. 我试图用'pg'更改我的Gemfile,我的组:assets更改为:production,我知道我遗漏了一些东西,但我不知道是什么。

Some ideas? 有什么想法吗?

Also when I go to the app url, I get this: 另外,当我转到应用程序URL时,会得到以下信息:

Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.

Thanks in advance for any suggest and help!!! 在此先感谢您的任何建议和帮助!!!

You have to use Postgres on Heroku, you can't use sqlite3 because Heroku prohibits you from saving to the file system. 您必须在Heroku上使用Postgres,而不能使用sqlite3,因为Heroku禁止您保存到文件系统。 So add the pg gem to your production bundle and re-deploy then your migrations should run. 因此,将pg gem添加到您的生产包中,然后重新部署,然后迁移就应该运行了。

Answer here is simple, add the following production in your gemfile as: 答案在这里很简单,添加下面的production在你的Gemfile为:

group :production do
  gem 'pg'
end

Your local machine won't work with this production, so we now have to bundle it by ignoring PostgreSQL gem which can be done as: 您的本地计算机不适用于此生产,因此我们现在必须通过忽略PostgreSQL gem来捆绑它,可以通过以下方式完成:

bundle install --without production

After this, try heroku rake db:migrate . 之后,尝试使用heroku rake db:migrate Must work. 必须工作。

Good luck 祝好运

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

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