db_preferences.rb 1.1 KB

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. case ActiveRecord::Base.connection_db_config.configuration_hash[:adapter]
  3. when 'mysql2'
  4. Rails.application.config.db_4bytes_utf8 = false
  5. Rails.application.config.db_column_array = false
  6. Rails.application.config.db_case_sensitive = false
  7. Rails.application.config.db_like = 'LIKE'
  8. Rails.application.config.db_null_byte = true
  9. # Because of missing ticket updates in high load environments
  10. # we changed the transaction isolation level equally to postgres
  11. # to READ COMMITTED which fixed the problem entirely #3877
  12. ActiveRecord::ConnectionAdapters::Mysql2Adapter.set_callback :checkout, :after do |conn|
  13. conn.execute('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED')
  14. rescue => e
  15. Rails.logger.error e
  16. end
  17. when 'postgresql'
  18. Rails.application.config.db_4bytes_utf8 = true
  19. Rails.application.config.db_column_array = true
  20. Rails.application.config.db_case_sensitive = true
  21. Rails.application.config.db_like = 'ILIKE'
  22. Rails.application.config.db_null_byte = false
  23. end