The Wire · Showcase
RAILS TIGHTENS MIGRATION REVERSIBILITY AND TIMESTAMPS VALIDATION
By RepoJournal · Filed · About Rails
Two critical migration fixes landed overnight that prevent silent failures when rolling back idempotent operations, plus stricter validation for ignored options in change_table blocks.
Rails now raises ArgumentError when remove_timestamps receives if_exists or if_not_exists options it cannot honor, closing the last gap in change_table validation [1]. Previously every other column-altering helper in change_table raised on ignored conditional options, but remove_timestamps quietly dropped them and proceeded anyway, masking developer intent during migrations.
Inversion of add_index and remove_index now correctly translates conditional modifiers so rollbacks stay idempotent [2]. The bug meant inverting add_index with if_not_exists carried the wrong option to the generated remove_index, and rolling back remove_index with if_exists lost its safety modifier entirely. Both scenarios would explode on replay if the index state didn't match the original migration attempt.
On the lighter side, Rails added this_quarter? to Date and Time [4], completing the predicate family alongside this_week?, this_month?, and this_year?. Also landed: documentation fix clarifying that number_to_percentage defaults to 3 decimal places, not 2 [3], bringing docs in line with actual behavior.
Action items
References
- [1] Raise on ignored if_exists option in change_table remove_timestamps rails/rails
- [2] Make add_index/remove_index if_(not_)exists reversible rails/rails
- [3] Fix incorrect number_to_percentage default precision in docs [ci skip] rails/rails
- [4] Add this_quarter? to Date/Time rails/rails
FAQ
- What changed in Rails on July 5, 2026?
- Two critical migration fixes landed overnight that prevent silent failures when rolling back idempotent operations, plus stricter validation for ignored options in change_table blocks.
- What should Rails teams do about it?
- Review migrations using remove_timestamps with conditional options and add error handling for any that do • Audit rollback tests for add_index/remove_index migrations to confirm idempotency works correctly
- Which Rails repositories shipped on July 5, 2026?
- rails/rails