braintree / pg_ha_migrations

Enforces DDL/migration safety in Ruby on Rails project with an emphasis on explicitly choosing trade-offs and avoiding unnecessary magic.
MIT License
220 stars 23 forks source link

Allow `:null => false` on PG11 when acceptable default is supplied #62

Closed jcoleman closed 3 years ago

jcoleman commented 3 years ago

In #51 we allowed setting a non-volatile default when adding adding a new column on PG11+. In the same situation we can also allow NOT NULL since the application of a non-volatile and non-null default value necessarily implies the column is NOT NULL (requiring no table scan -- which, while not clear in the commit message of the PG11 commit adding this feature, we confirmed by checking the seq_scan stats count on a test table).

Co-authored-by: Jonathan Lukens jonathan.lukens@gmail.com