Geo: Use text limit constraints

Background

  • We sometimes use text limits in migrations: https://gitlab.com/gitlab-org/gitlab/-/blob/2d02e88b1adf6a71c5405e38e70c847bf8a19aa0/ee/db/geo/migrate/20200811171011_create_snippet_repository_registry.rb#L27
  • But ee/db/geo/schema.rb doesn't appear to record those constraints: https://gitlab.com/gitlab-org/gitlab/-/blob/2d02e88b1adf6a71c5405e38e70c847bf8a19aa0/ee/db/geo/schema.rb#L206

Problem

Therefore it seems like new installs do not have text limits in the tracking DB.

Questions

  • How do we align all existing installs?

Proposal

  • Open a small MR to modify https://gitlab.com/gitlab-org/gitlab/-/blob/c485d2a0be659c1860008bc78272cdef42efae5e/doc/development/geo/framework.md to define last_sync_failure as a string/varchar with a limit, instead of using add_text_limit (there are 2 occurrences for the registry table). => !56446 (merged)
  • Switch to structure.sql => #341758 (closed)
  • Just in case, clear fields if they are over the text limits that we will add in the next step
  • Add migrations that create text limit constraints for existing text fields if they don't exist. (I don't think this needs multiple releases since the code is already expected to properly truncate the text before insert/update.)
  • Ensure all text fields in structure.sql have limit constraints
Edited Nov 30, 2021 by Michael Kozono
Assignee Loading
Time tracking Loading