You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: backfill_note_discussion_id.rb
    path of file: ./repos/gitlabhq/lib/gitlab/background_migration
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # Fixes notes with NULL discussion_ids due to a bug when import
    
      def update_discussion_ids(notes)
        mapping = notes.index_with do |note|
          { discussion_id: note.generate_discussion_id }
        end

        Gitlab::Database::BulkUpdate.execute(%i[discussion_id], mapping)
      end