File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,12 @@ def setup
32
32
@verbose_was = ActiveRecord ::Migration . verbose
33
33
@connection = ActiveRecord ::Base . connection
34
34
@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
36
41
ActiveRecord ::InternalMetadata . create_table
37
42
ActiveRecord ::Migration . verbose = false
38
43
@connection . execute ( "SET statement_timeout TO '70s'" )
You can’t perform that action at this time.
0 commit comments