提升迁移文件效率
This commit is contained in:
parent
8d30bec8a4
commit
0ba9cfe5dd
|
@ -1,9 +1,9 @@
|
|||
class UpdateActivitiesData < ActiveRecord::Migration
|
||||
def up
|
||||
count = Activity.all.count / 10 + 1
|
||||
count = Activity.all.count / 20 + 1
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
Activity.all.each do |activity|
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue