Skip to content

Commit 1ee1e4e

Browse files
Rails main fix
1 parent 22cbee3 commit 1ee1e4e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/migration_tools/tasks.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ def migrations_paths
2828
end
2929

3030
def migrator(target_version = nil)
31-
if ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR >= 1
31+
if ActiveRecord::VERSION::MAJOR == 7 && ActiveRecord::VERSION::MINOR == 1
3232
migrate_up(ActiveRecord::MigrationContext.new(
3333
migrations_paths,
3434
ActiveRecord::Base.connection.schema_migration
3535
).migrations, target_version)
36+
elsif ActiveRecord.gem_version >= Gem::Version.new("7.2")
37+
migrate_up(ActiveRecord::MigrationContext.new(
38+
migrations_paths,
39+
ActiveRecord::Base.connection_pool.schema_migration
40+
).migrations, target_version)
3641
else
3742
migrate_up(ActiveRecord::MigrationContext.new(
3843
migrations_paths,
@@ -42,11 +47,16 @@ def migrator(target_version = nil)
4247
end
4348

4449
def migrate_up(migrations, target_version)
45-
if ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR >= 1
50+
if ActiveRecord::VERSION::MAJOR == 7 && ActiveRecord::VERSION::MINOR == 1
4651
ActiveRecord::Migrator.new(:up, migrations,
4752
ActiveRecord::Base.connection.schema_migration,
4853
ActiveRecord::Base.connection.internal_metadata,
4954
target_version)
55+
elsif ActiveRecord.gem_version >= Gem::Version.new("7.2")
56+
ActiveRecord::Migrator.new(:up, migrations,
57+
ActiveRecord::Base.connection_pool.schema_migration,
58+
ActiveRecord::Base.connection_pool.internal_metadata,
59+
target_version)
5060
else
5161
ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration, target_version)
5262
end

0 commit comments

Comments
 (0)