Adapt migration helper for adding columns with a default to use PG11 feature
Adding columns with a default value has been problematic with <PG11 because typically that lead to a full rewrite of the table to update existing records. We've implemented migration helpers to spread this out (add_column_with_default
), our docs go into detail how to do it and there are rubocops in place to detect problematic instances.
Going forward, with PG11, adding a column with a default value doesn't touch existing data anymore. This is a PG11 improvement.
In this issue, we change migration helpers, docs and rubocops to reflect that and make it generally easier to add columns with default values.
Background read: https://www.2ndquadrant.com/en/blog/add-new-table-column-default-value-postgresql-11/