From 44717252228fae0682be9eb8cf05251092ca200b Mon Sep 17 00:00:00 2001 From: James Woodrow Date: Sun, 12 Nov 2023 15:49:34 +0100 Subject: [PATCH 1/3] Remove Rails 7.2 warning --- .../connection_adapters/makara_abstract_adapter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/active_record/connection_adapters/makara_abstract_adapter.rb b/lib/active_record/connection_adapters/makara_abstract_adapter.rb index a1ba8d69..caf928c6 100644 --- a/lib/active_record/connection_adapters/makara_abstract_adapter.rb +++ b/lib/active_record/connection_adapters/makara_abstract_adapter.rb @@ -212,7 +212,8 @@ def initialize(proxy) @proxy = proxy @owner = nil @pool = nil - @schema_cache = ActiveRecord::ConnectionAdapters::SchemaCache.new @proxy + schema_reflection = ActiveRecord::ConnectionAdapters::SchemaReflection.new(nil).load!(@proxy) + @schema_cache = ActiveRecord::ConnectionAdapters::BoundSchemaReflection.new(schema_reflection, @proxy) @idle_since = Concurrent.monotonic_time @adapter = ActiveRecord::ConnectionAdapters::AbstractAdapter.new(@proxy) end From e90cf9c7415d8e6d1ea5116ee7f8ac4280724ddd Mon Sep 17 00:00:00 2001 From: James Woodrow Date: Sun, 12 Nov 2023 15:54:53 +0100 Subject: [PATCH 2/3] Add workflow_dispatch to CI so it can be triggered manually if needed --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 235e30f5..c723a75c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,6 +5,7 @@ on: branches: - master pull_request: + workflow_dispatch: jobs: build: From 3847abdae6d19864f002510be920f446a150fe35 Mon Sep 17 00:00:00 2001 From: James Woodrow Date: Sun, 12 Nov 2023 15:59:02 +0100 Subject: [PATCH 3/3] Add condition to only use SchemaReflection if ActiveRecord >= 7.1 --- .../connection_adapters/makara_abstract_adapter.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/active_record/connection_adapters/makara_abstract_adapter.rb b/lib/active_record/connection_adapters/makara_abstract_adapter.rb index caf928c6..6c8e889d 100644 --- a/lib/active_record/connection_adapters/makara_abstract_adapter.rb +++ b/lib/active_record/connection_adapters/makara_abstract_adapter.rb @@ -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