Class: Gitlab::BackgroundMigration::FixPromotedEpicsDiscussionIds

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/fix_promoted_epics_discussion_ids.rb

Overview

This migration updates discussion ids for epics that were promoted from issue so that the discussion id on epics is different from discussion id on issue, which was causing problems when replying to epic discussions as it would identify the discussion as related to an issue and complaint about missing project_id

Defined Under Namespace

Classes: Note

Instance Method Summary collapse

Instance Method Details

#perform(discussion_ids) ⇒ Object


15
16
17
18
19
# File 'lib/gitlab/background_migration/fix_promoted_epics_discussion_ids.rb', line 15

def perform(discussion_ids)
  Note.where(noteable_type: 'Epic')
    .where(discussion_id: discussion_ids)
    .update_all("discussion_id=MD5(discussion_id)||substring(discussion_id from 1 for 8)")
end