RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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 integer to bigint)
  • 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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in