In my opinion, as soon as each project database, especially production, at least on version 201xxxxxxxx, it should be good to remove migrations to this version. They are no longer technically necessary.
After that, if you want to play archeology with the history of the database, you can still use your version control system.
With Git , you can use the following commands to quickly view the past:
git log --name-only db/migrate/
In addition, you can view the schema.rb repository schema.rb , identify the commit, and see the corresponding migration content using the command above.
If you prefer to have a lighter db/migrate and use version control, I would fix it a bit.
If it would be more convenient for you to have all the available migration history, since it is easier to view, I would choose option 1.
Note : it is very likely that old migrations do not make sense with the current application code. For example, some migrations may refer to a class or methods that no longer exist. Using version control to validate an application while writing a migration can also avoid some confusion.
Adrienk
source share