Skip to content

Commit

Permalink
Add condition to only use SchemaReflection if ActiveRecord >= 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoodrow authored Nov 12, 2023
1 parent e90cf9c commit 3847abd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ def initialize(proxy)
@proxy = proxy
@owner = nil
@pool = nil
schema_reflection = ActiveRecord::ConnectionAdapters::SchemaReflection.new(nil).load!(@proxy)
@schema_cache = ActiveRecord::ConnectionAdapters::BoundSchemaReflection.new(schema_reflection, @proxy)
if ActiveRecord.version >= Gem::Version.new('7.1.0')
schema_reflection = ActiveRecord::ConnectionAdapters::SchemaReflection.new(nil).load!(@proxy)
@schema_cache = ActiveRecord::ConnectionAdapters::BoundSchemaReflection.new(schema_reflection, @proxy)
else
@schema_cache = ActiveRecord::ConnectionAdapters::SchemaCache.new @proxy
end
@idle_since = Concurrent.monotonic_time
@adapter = ActiveRecord::ConnectionAdapters::AbstractAdapter.new(@proxy)
end
Expand Down

0 comments on commit 3847abd

Please sign in to comment.