Rubocop to enforce length constraint to string columns

We should enforce database-side limits to any new text, string or other variable length fields. Let's create a rubocop to detect this and fail if no limit is present.

There should never be a situation where we create a variable length field without the ability to put a (maybe high, but that's also fine as it makes it clear what to expect) limit on it.

cc @gl-database

Development log

  • It was decided (https://gitlab.com/gitlab-org/gitlab-ce/issues/64505#note_196251902) that the cop will only enforce the limit on string columns, as text columns are trickier (they imply a table rewrite)
Edited Aug 27, 2025 by Dave Smith
Assignee Loading
Time tracking Loading