How to disable prepared statement in heroku with postgres database

后端 未结 6 1100
-上瘾入骨i
-上瘾入骨i 2021-02-20 12:13

I fixed an issue on my rails project locally (with postgres config) while adding in database.yml this statement:

test:
  prepared_statements: false
6条回答
  •  醉话见心
    2021-02-20 12:45

    Recently it seems that Heroku has disabled setting DATABASE_URL using heroku config:set DATABASE_URL=?prepared_statements=false, giving us back an error " ▸ Cannot overwrite attachment values DATABASE_URL."

    In order to resolve this, we added an disabled_prepared_statements.rb initializer in config/ containing:

    ActiveRecord::Base.configurations[Rails.env].merge!(prepared_statements: false)

提交回复
热议问题