Skip to content

Commit

Permalink
Use ConnectionPool#schema_migration in Rails 7.2
Browse files Browse the repository at this point in the history
See rails/rails#51162 for details.
  • Loading branch information
theodorton committed Jun 2, 2024
1 parent ee47eaf commit 2ec4432
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/support/paper_trail_spec_migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize
def migrate
::ActiveRecord::MigrationContext.new(
@migrations_path,
::ActiveRecord::Base.connection.schema_migration
schema_migration
).migrate
end

Expand All @@ -45,6 +45,14 @@ def generate_and_migrate(generator, generator_invoke_args)

private

def schema_migration
if Rails::VERSION::STRING >= "7.2"
::ActiveRecord::Base.connection_pool.schema_migration
else
::ActiveRecord::Base.connection.schema_migration
end
end

def dummy_app_migrations_dir
Pathname.new(File.expand_path("../dummy_app/db/migrate", __dir__))
end
Expand Down

0 comments on commit 2ec4432

Please sign in to comment.