socialforge/db/migrate/20160126024429_update_journ...

21 lines
554 B
Ruby
Raw Normal View History

2016-01-26 11:17:55 +08:00
class UpdateJournalForMessage < ActiveRecord::Migration
def up
journals = JournalsForMessage.where("m_parent_id is null and jour_type ='Principal' ")
count = journals.count / 30 + 2
transaction do
for i in 1 ... count do i
journals.page(i).per(30).each do |jour|
act = UserActivity.where("act_type='JournalsForMessage' and act_id = #{jour.id}").first
unless act.nil?
jour.updated_on = act.updated_at
jour.save
end
end
end
end
end
def down
end
end