class MoveContentOfMessagesToMessageDetails < ActiveRecord::Migration[5.2]
  def change
    Message.find_each do |msg|
      unless msg.message_detail.present?
        message_detail = MessageDetail.create(message: msg, content: msg.content)
        puts "-------> create MessageDetail success: id is #{message_detail.id}"
      end
    end
  end
end
