From c23beaf656bfb6ee27b7493bfa274d209be3544f Mon Sep 17 00:00:00 2001 From: Isaac Betesh Date: Tue, 22 Dec 2020 11:25:05 -0800 Subject: [PATCH] Fix code that's broken by rails 6.1 breaking changes. Fixes #37 --- lib/active_record/postgres/constraints/railtie.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/active_record/postgres/constraints/railtie.rb b/lib/active_record/postgres/constraints/railtie.rb index 30f2807..ab168f5 100644 --- a/lib/active_record/postgres/constraints/railtie.rb +++ b/lib/active_record/postgres/constraints/railtie.rb @@ -9,6 +9,11 @@ class Railtie < ::Rails::Railtie engine = self ActiveSupport.on_load(:active_record) do AR_CAS = ::ActiveRecord::ConnectionAdapters + AR_CAS_SCHEMA_CREATION = if defined?(AR_CAS::AbstractAdapter::SchemaCreation) + AR_CAS::AbstractAdapter::SchemaCreation + else + AR_CAS::SchemaCreation + end engine.apply_patch! if engine.pg? end @@ -20,7 +25,7 @@ def apply_patch! end AR_CAS::TableDefinition.include TableDefinition AR_CAS::PostgreSQLAdapter.include PostgreSQLAdapter - AR_CAS::AbstractAdapter::SchemaCreation.prepend SchemaCreation + AR_CAS_SCHEMA_CREATION.prepend SchemaCreation ::ActiveRecord::Migration::CommandRecorder.include CommandRecorder ::ActiveRecord::SchemaDumper.prepend SchemaDumper