Skip to content

Make chat_names table migration idempotent

Stan Hu requested to merge sh-fix-chat-names-migration-16-6 into 16-6-stable-ee

What does this MR do and why?

This backports !141703 (merged) to 16-6-stable-ee.

GitLab 16.5.6, 16.6.4, and 16.7.2 added a migration that added columns chat_names.encrypted_token and chat_names.encrypted_token_iv. Unfortunately, the migration was added as different filenames. As a result, if users upgrade to 16.5.6 or 16.6.4 first, they'll already have those columns, and the next upgrade to 16.7.2 will fail.

To prevent an upgrade failure, we need to make the migration idempotent so that it can be applied again without issues.

For reference, these are the filenames that are used in different versions:

  • 16.8 - db/migrate/20231123160255_add_token_to_chat_names.rb
  • 16.7 - db/migrate/20231219120134_add_token_to_chat_names.rb
  • 16.6 - db/migrate/20231215135014_add_token_to_chat_names.rb
  • 16.5 - db/migrate/20231215145632_add_token_to_chat_names.rb

Relates to omnibus-gitlab#8371 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to (not applicable for documentation or spec changes).
  • This MR has a severity label assigned (if applicable).
  • Set the milestone of the merge request to match the target backport branch version.
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the e2e:package-and-test-ee job has either succeeded or been approved by a Software Engineer in Test.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

Edited by Stan Hu

Merge request reports