2015-08-11 14:49:32 +08:00
|
|
|
class UpdateActivitiesData < ActiveRecord::Migration
|
|
|
|
def up
|
2015-08-29 15:34:18 +08:00
|
|
|
# count = Activity.all.count / 20 + 1
|
|
|
|
# transaction do
|
|
|
|
# for i in 1 ... count do i
|
|
|
|
# Activity.page(i).per(20).each do |activity|
|
|
|
|
# type = activity.act_type
|
|
|
|
# if type=='Contest' || type=='Message' || type=='News'|| type=='Journal'|| type=='Issue'|| type=='Principal'||type=='JournalsForMessage'
|
|
|
|
# activity.created_at = activity.act.created_on if activity.act
|
|
|
|
# elsif type=='Contestnotification' || type=='HomeworkCommon' || type=='Poll'
|
|
|
|
# activity.created_at = activity.act.created_at if activity.act
|
|
|
|
# end
|
|
|
|
# activity.save
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
# end
|
2015-08-11 14:49:32 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|