lib/table_saw.rb in table_saw-3.1.0 vs lib/table_saw.rb in table_saw-3.2.0
- old
+ new
@@ -1,9 +1,11 @@
# frozen_string_literal: true
+require 'active_record'
+require 'active_support/core_ext/string'
+
require 'table_saw/configuration'
-require 'table_saw/connection'
require 'table_saw/dependency_graph'
require 'table_saw/information_schema'
require 'table_saw/manifest'
require 'table_saw/queries'
require 'table_saw/formats'
@@ -27,8 +29,22 @@
def self.information_schema
@information_schema ||= TableSaw::InformationSchema.new
end
def self.schema_cache
- TableSaw::Connection.adapter.schema_cache
+ connection.schema_cache
end
+
+ def self.connection_pool
+ ActiveRecord::Base.connection_pool
+ end
+
+ # :nocov:
+ def self.connection
+ if ActiveRecord.gem_version < Gem::Version.new('7.2.0')
+ connection_pool.connection
+ else
+ connection_pool.lease_connection
+ end
+ end
+ # :nocov:
end