Skip to content
Snippets Groups Projects

Backfill internal column on notes

Merged Nicolas Dular requested to merge nd/confidential-to-internal-notes-bg-migration into master

What does this MR do and why?

Issue: #374527 (closed)

As we rename confidential to internal we now need to backfill existing data to the new column. We already sync new confidential notes with !97253 (merged).

We need to use a background migration as Notes is a large & high traffic table.

Database migration

r db:migrate
main: == 20220920124709 BackfillInternalOnNotes: migrating ==========================
main: == 20220920124709 BackfillInternalOnNotes: migrated (0.0583s) =================

ci: == 20220920124709 BackfillInternalOnNotes: migrating ==========================
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_shared, :gitlab_internal].
ci: == 20220920124709 BackfillInternalOnNotes: migrated (0.0001s) =================
r db:rollback:ci db:rollback:main
ci: == 20220920124709 BackfillInternalOnNotes: reverting ==========================
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_shared, :gitlab_internal].
ci: == 20220920124709 BackfillInternalOnNotes: reverted (0.0001s) =================

main: == 20220920124709 BackfillInternalOnNotes: reverting ==========================
main: == 20220920124709 BackfillInternalOnNotes: reverted (0.0132s) =================

How to set up and validate locally

  1. Create a non-confidential comment on an issue (or find one)
  2. bin/rails c
  3. Replicate existing confidential notes that are not synced:
    1. Note.last.update_attribute(:confidential, true) (We need to skip validations, as existing notes can't be set to confidential)
    2. Note.last.confidential #=> true
    3. Note.last.internal #=> false
  4. Run the migration in this MR
  5. Note.last.internal should be true

MR acceptance checklist

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

Edited by Nicolas Dular

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Nicolas Dular requested review from @aluthra2

    requested review from @aluthra2

  • Nicolas Dular requested review from @euko

    requested review from @euko

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading