Too Many Migrations!

I recently started a new job as a rails developer. It’s my first foray into enterprise rails development in three years. One thing I noticed when looking into the new codebases I would be working with, too many migrations! In my opinion, migration files should be archived once the database schema has stabilized. Now I wouldn’t delete them, just in case something goes horribly wrong (but that would be very unlikely). Migration files should only be used to make deltas to the database, if the database is stable then there’s no reason to hold on to the deltas that built up to that version.

Here are some other best practices for migrations:

Rebuilding the database

Say you’re recreating the development database on a new computer or are a new developer on project.

rake db:create
rake db:schema:load

What goes in a migration

Short answer! only changes to database schema. If you need to input data do it in the seed.rb or a rake task.

If there are any more best practices let me know.