Deploy Rails Application on Heroku : ERROR

I am trying to execute heroku run rake db:migrate, but that's the result : rake aborted! PG::Error: ERROR: invalid value for parameter "client_encoding": "utf8mb4"

I want to use mysql database in development and postgres in production, and so that's the way that I configured my database.yml :

postgres: &postgres
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
mysql: &mysql
  adapter: mysql2
  encoding: utf8mb4
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  username: root
  password:
  socket: /var/run/mysqld/mysqld.sock
development:
  <<: *mysql
  database: event_development
test:
  <<: *mysql
  database: event_test
production:
  <<: *postgres
  database: event_production
  username: event
  password: <%= ENV['EVENT_DATABASE_PASSWORD'] %>

How can I solve this?

Upvotes: 0

Views: 300

Answers (1)

7urkm3n
7urkm3n

Reputation: 6321

Just use url for it. If you have installed "Heroku Postgres" add-on. There supposed to be the DATABASE_URL in config vars.

heroku_config_vars

database.yml:

...
production:
   url: <%= ENV['DATABASE_URL'] %>

Upvotes: 1

Related Questions