class UpdateMessageTime < ActiveRecord::Migration
  def up
    # course_count = CourseMessage.all.count / 30 + 1
    # transaction do
    #   for i in 1 ... course_count do i
    #   CourseMessage.page(i).per(30).each do |cmessage|
    #     if cmessage.course_message
    #       if cmessage.course_message.respond_to?("created_at")
    #         cmessage.created_at = cmessage.course_message.created_at
    #       elsif cmessage.course_message.respond_to?("created_on")
    #         cmessage.created_at = cmessage.course_message.created_on
    #       end
    #       cmessage.save
    #       puts cmessage.id
    #
    #       course_all_message = MessageAll.where("message_type = '#{cmessage.class.to_s}' and message_id = '#{cmessage.id}'").first
    #       course_all_message.created_at = cmessage.created_at
    #       course_all_message.save
    #     end
    #   end
    #   end
    # end
  end

  def down
  end
end
