0

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?

1 Answer 1

1

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'] %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.