Skip to content

Commit 5e2efd1

Browse files
instanciate ActiveRecord::SchemaMigration with the right connection for Activerecord 7.1 or above
1 parent 1803fcb commit 5e2efd1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/test_helper.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ def setup
3232
@verbose_was = ActiveRecord::Migration.verbose
3333
@connection = ActiveRecord::Base.connection
3434
@connection.tables.each { |table| @connection.drop_table table, force: :cascade }
35-
ActiveRecord::SchemaMigration.create_table
35+
# only instanciate ActiveRecord::SchemaMigration with the right connection for Activerecord 7.1 or above
36+
if Gem::Requirement.new('>=7.1.0').satisfied_by?(Gem::Version.new(::ActiveRecord::VERSION::STRING))
37+
ActiveRecord::SchemaMigration.new(@connection).create_table
38+
else
39+
ActiveRecord::SchemaMigration.create_table
40+
end
3641
ActiveRecord::InternalMetadata.create_table
3742
ActiveRecord::Migration.verbose = false
3843
@connection.execute("SET statement_timeout TO '70s'")

0 commit comments

Comments
 (0)