Rails migrations - what to do with old migrations after you upgrade Rails version? e.g. ActiveRecord::Migration[5.2] => 6,1

Viewed 168

I have a legacy Rails app that's in production for a few years. It started as Rails 5.2 app and has been recently upgraded to Rails6+.

ag ActiveRecord db/migrate | grep Migration
db/migrate/20181012164950_add_foos.rb:3: class AddFoos < ActiveRecord::Migration[5.2]
db/migrate/20201008043949_add_bars.rb:3: class AddBars < ActiveRecord::Migration[6.1]

I'm wondering what's the recommended way of handling db migrations generated in an older Rails version(notice ActiveRecord::Migration[5.2] parent class name) after you upgraded your Rails dependency?

Is it recommended to update those numbers(e.g. [5.2] to your latest version instead(to future proof it)? Is it safe at all?

Related questions:

What are the brackets [5.1] after ActiveRecord Migration and how does it work?

how to understand "ActiveRecord::Migration[5.2]" rails / ruby

0 Answers
Related