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: 20190626225031_convert_trusted_discussions_to_conversations.rb
    path of file: ./repos/sugar/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class ConvertTrustedDiscussionsToConversations < ActiveRecord::Migration[5.2]
  def up
    trusted_users = User.active_and_memo
    
  def up
    trusted_users = User.active_and_memorialized.where(
      "trusted = ? OR admin = ? OR user_admin = ? OR moderator = ?",
      true,
      true,
      true,
      true
    )

    Discussion.where(trusted: true).find_each do |d|
      raise Discussion::InvalidExchange unless d.valid?

      d.update(type: "Conversation")
      d.becomes(Conversation).tap do |conversation|
        conversation.unlabel!
        d.posts.each { |p| p.update(conversation: true) }
        trusted_users.each do |p|
          conversation.add_participant(p, new_posts: false)
        end
        d.discussion_relationships.destroy_all
      end
    end
  end