I’m publishing a new gem today. The name is
online_migrations, it’s at https://github.com/fatkodima/online_migrations. For those familiar with
strong_migrations, it is a
strong_migrations on steroids.
It allows to catch unsafe migrations (like adding a column with a default, removing a column, adding an index non-concurrently etc) in development and provides instructions and migrations helpers to run them easily and without downtime in production.
It has migrations helpers for:
- renaming tables/columns
- changing columns types (including changing primary/foreign keys from
- adding columns with default values
- adding different types of constraints
- and others
Additionally, it has an internal framework for running data migrations on very large tables using background migrations. For example, you can use background migrations to migrate data that’s stored in a single JSON column to a separate table instead; backfill values from one column to another (as one of the steps when changing column type); or backfill some column’s value from an API.
It supports ruby 2.1+, rails 4.2+ and PostgreSQL 9.6+.