Zero downtime PostgreSQL migrations with online_migrations gem
https://github.com/fatkodima/online_migrations - for those familiar with strong_migrations, it is a “strong_migrations on steroids”.
With this gem you can catch risky migrations before they hit production. It consists of many checks (like adding a column with a default, removing a column, adding an index non-concurrently etc) as well as migration helpers to run many operations easier.
It has migrations helpers for:
- renaming tables/columns
- changing columns types (including changing primary/foreign keys from
integertobigint) - 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+.
Post a comment