Skip to content

Fix --show-migration option not working on Rails 7.2+.#327

Open
OdenTakashi wants to merge 1 commit intomainfrom
fix/show-migration-rails-7.2
Open

Fix --show-migration option not working on Rails 7.2+.#327
OdenTakashi wants to merge 1 commit intomainfrom
fix/show-migration-rails-7.2

Conversation

@OdenTakashi
Copy link
Copy Markdown
Collaborator

@OdenTakashi OdenTakashi commented Apr 21, 2026

Problem

ConnectionAdapter#migration_context was deprecated in Rails 7.1 and removed in Rails 7.2 (rails/rails#51162).
The existing code called connection.migration_context.current_version, which raises NoMethodError on Rails 7.2+.

Solution

Use connection.pool.migration_context when available (Rails 7.1+), falling back to connection.migration_context for older versions.

## Problem
`ConnectionAdapter#migration_context` was deprecated in Rails 7.1 and removed in Rails 7.2 (rails/rails#51162).
`The existing code called
`connection.migration_context.current_version`, which raises `NoMethodError` on Rails 7.2+.

## Solution
Use `connection.pool.migration_context` when available (Rails 7.1+), falling back to `connection.migration_context` for older versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant