Must-have gem for rails projects: zero downtime migrations

This is one of the most useful Ruby gems I’ve discovered in a while: zero_downtime_migrations, it catches problematic migrations at development time.

Problems such as:

  • Adding a column with a default in a single migration;
  • Adding a non-concurrent index;
  • Mixing data changes with index or schema migrations;
  • Performing data or schema migrations with the DDL transaction disabled;
  • Using each instead of find_each to loop thru ActiveRecord objects when doing data changes;

And it doesn’t only catch the problem but it also teaches what you should do to avoid it 👏👏

Example from their README:

Solution of problem and solution

Seriously, share this gem with every Rails developer you know and make everybody’s life a bit easier 😁

Leave a Comment