Description: support ActiveRecord 7
Origin: https://github.com/DatabaseCleaner/database_cleaner-active_record/commit/092b4ff14f1806418bb170b40b85a1b7d0b852af
Forwarded: not-needed
Last-Update: 2025-03-04

Index: ruby-database-cleaner/lib/database_cleaner/active_record/base.rb
===================================================================
--- ruby-database-cleaner.orig/lib/database_cleaner/active_record/base.rb	2025-03-04 18:14:27.154503427 +0000
+++ ruby-database-cleaner/lib/database_cleaner/active_record/base.rb	2025-03-04 18:14:27.154503427 +0000
@@ -58,8 +58,10 @@
       end
 
       def self.migration_table_name
-        if ::ActiveRecord::VERSION::MAJOR < 5
-          ::ActiveRecord::Migrator.schema_migrations_table_name
+        if ::ActiveRecord::Base.connection_pool.respond_to?(:schema_migration) # Rails >= 7.2
+          ::ActiveRecord::Base.connection_pool.schema_migration.table_name
+        elsif ::ActiveRecord::Base.connection.respond_to?(:schema_migration) # Rails >= 6.0
+          ::ActiveRecord::Base.connection.schema_migration.table_name
         else
           ::ActiveRecord::SchemaMigration.table_name
         end
