socialforge/db/migrate/20150829081822_update_messa...

28 lines
930 B
Ruby
Raw Normal View History

2015-08-29 17:09:44 +08:00
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
2015-08-29 17:09:44 +08:00
end
def down
end
end