Я пытаюсь подтолкнуть свое приложение к героку, но не проходит - PullRequest
0 голосов
/ 05 июля 2019

Новичок здесь.Я пытаюсь перенести мое приложение на heroku, скачал postgres и удалил гем 'sqlite3' из моего гемфайла.Мне нужно обновить свой database.yml и не знаю, что поставить перед "my_database_development" ??это мой вопросКак мне настроить

Это мой код

default: &default
  adapter: postgresql
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default

  database: db/production.sqlite3


, и я пытаюсь добиться следующего

development:
  adapter: postgresql
  database: my_database_development
  pool: 5
  timeout: 5000
test:
  adapter: postgresql
  database: my_database_test
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: my_database_production
  pool: 5
  timeout: 5000


Вот ссылка, по которой я следую

https://devcenter.heroku.com/articles/sqlite3#getting-a-sqlite-error-even-though-it-is-not-in-the-gemfile

Ошибка в моем терминале

remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected sqlite3 gem which is not supported on Heroku:
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to orouge.
remote: 
To https://git.heroku.com/orouge.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/orouge.git'

Ответы [ 2 ]

0 голосов
/ 05 июля 2019

Это происходит, когда вы добавили postgres в ваш gemfile, но вы либо:

  1. Не удалили sqlite3 из вашего gemfile
  2. Вы не запустили bundle installпосле добавления postgres и удаления sqlite3
0 голосов
/ 05 июля 2019

Хорошо, код, который у вас есть, все еще ссылается на sqlite

  database: db/production.sqlite3

Используйте другой блок, который у вас есть.Также возможно, что в вашем Gemfile.lock есть ссылка на sqlite, но я думаю, что он перезаписывается при развертывании.

Вот ссылка на примеры файлов database.yml, сделайте ваш взглядкак тот для postgres.

https://gist.github.com/jwo/4512764

...