How to disable prepared statement in heroku with postgres database

后端 未结 6 1206
-上瘾入骨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:29

    As of Feb 19th 2014, heroku no longer overrides database.yml so you can turn off prepared statements in your production and staging (or default) block of the database.yml file as recommended by the latest docs:

    default: &default
      adapter: postgresql
      encoding: unicode
      pool: 5
      prepared_statements: false
    
    development:
      <<: *default
      database: myapp_development
    
    test:
      <<: *default
      database: myapp_test
    
    production:
      <<: *default
      url:  <%= ENV['DATABASE_URL'] %>
      pool: <%= ENV['DB_POOL'] || ENV['MAX_THREADS'] || 5 %>
    
    staging:
      <<: *default
      url:  <%= ENV['DATABASE_URL'] %>
      pool: <%= ENV['DB_POOL'] || ENV['MAX_THREADS'] || 5 %>
    

提交回复
热议问题