Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

allow disabling postgres type cache via env

Markus Kahl55ab48c56a1e
diff --git a/config/initializers/postgres_type_cache.rb b/config/initializers/postgres_type_cache.rb
index 0a7385c715c..c846ff82d8c 100644
--- a/config/initializers/postgres_type_cache.rb
+++ b/config/initializers/postgres_type_cache.rb
@@ -184,11 +184,13 @@ module ActiveRecord
end
end
-require "active_record/connection_adapters/postgresql_adapter"
-require 'active_record/connection_adapters/abstract/connection_pool'
+unless String(ENV["USE_POSTGRES_TYPE_CACHE"]).strip.downcase == "false"
+ require "active_record/connection_adapters/postgresql_adapter"
+ require 'active_record/connection_adapters/abstract/connection_pool'
-ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- .prepend ActiveRecord::ConnectionAdapters::PostgresAdapterTypeCache
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
+ .prepend ActiveRecord::ConnectionAdapters::PostgresAdapterTypeCache
-ActiveRecord::ConnectionAdapters::AbstractPool
- .prepend ActiveRecord::ConnectionAdapters::AbstractPoolTypeCache
+ ActiveRecord::ConnectionAdapters::AbstractPool
+ .prepend ActiveRecord::ConnectionAdapters::AbstractPoolTypeCache
+end