【问题标题】:I can't migrate the database of my Rails app on Heroku with sqlite我无法使用 sqlite 在 Heroku 上迁移我的 Rails 应用程序的数据库
【发布时间】:2017-11-06 20:07:23
【问题描述】:

我正在关注 this tutorial 创建 Ruby on Rail 应用程序,但遇到了障碍。我正在尝试将其数据库迁移到 Heroku,结果却被告知:

c:\Sites\railsbridge\test_app>heroku run rails db:migrate
Running rails db:migrate on floating-ocean-40882... up, run.5709 (Free)
rails aborted!
Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not 
loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the 
minimum required by ActiveRecord).

已经在我的 Gemfile 中列出了 sqlite3,我做错了什么?

【问题讨论】:

  • 如果你想使用 Heroku,那么你需要使用 pg gem 来使用 Postgresql 而不是 Sqlite。
  • 如果您先搜索过这个答案,则可以在 Stackoverflow Heroku's documentation site 上找到它。下次复制错误信息,搜索一下。

标签: ruby-on-rails-3 heroku sqlite


【解决方案1】:

Heroku 不支持 sqlite,建议使用 postgresql 进行生产

请看下面的帖子

Heroku deployment failed because of sqlite3 gem error

Deploying RoR app to Heroku with Sqlite3 fails

您可以将 Postgresql 用于生产,并且更改应该很简单。只需更改 Gemfile 中的 gem 并更改 database.yml 即可。

【讨论】:

    【解决方案2】:

    Heroku 不支持 SQLite 它只支持 PostgresSQL 这里是完整的documentation 用于在 Heroku 上部署

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-24
      • 2020-09-13
      • 1970-01-01
      • 2012-04-26
      • 2021-08-07
      • 2015-03-21
      • 2010-12-16
      相关资源
      最近更新 更多