Skip to content

Prevent `add_text_limit` to be used with `validate: true` on tables with invalid data

add_text_limit helper was introduced on !29181 (merged) and it allows us adding a limit to a text column after creating a new table.

By default it has validate: true, which means it validates the constraint against the existing values of the column, this can cause a failure at runtime if the table has invalid data.

Proposal: Split the usage of add_text_limit across multiple releases

If add_text_limit is used on a table with invalid data (or perhaps a large table):

  • We add the limit with add_text_limit - Release M
  • We add a clean up (post-migration) to take care of the invalid data - Release M
  • We enforce validate: true - Release M + 1

If add_text_limit is used on a table with valid data we can use validate: true safely.

Edited by Mayra Cabrera