Skip to content

Blacklist tables for add_column_with_default

Andreas Brandl requested to merge ab/blacklist-add-column-with-default into master

What does this MR do?

We added a rubocop to warn about using add_column_with_default ... allow_nulls: false. This was meant to spark discussion about whether or not the table in question is potentially too large and if we would expect problems on large installations like GitLab.com.

However, I think it rather led to confusion and actually avoiding the helper all together (and finding more creative solutions to work around the cop ;) ). It is relatively safe to ignore the cop for small tables. Only for larger tables, we need to discuss in more detail during review.

I would like to turn the logic around and only trigger the warning for selected tables. Here, I've selected all tables from GitLab.com larger than 10 GB (also see Grafana):

Screenshot_from_2020-02-25_11-21-04

In the longer term, the whole topic should go away with #207820 (closed).

Note we also have Migration/UpdateLargeTable which is related: In contrast to this cop, the cop we're changing here only cares about allow_null: false variants of the helper. This is because validating the NOT NULL constraint can take quite some time - in that sense, it's only tangentially related to the other cop.

Issue: #198351 (closed)

Does this MR meet the acceptance criteria?

Conformity

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading