2016-01-12 10:38:50 +08:00
|
|
|
class StaticProjectActs < ActiveRecord::Migration
|
|
|
|
def up
|
|
|
|
Project.all.each do |project|
|
2016-01-12 15:10:02 +08:00
|
|
|
acts = ForgeActivity.where("project_id = ?", project.id)
|
|
|
|
unless acts.blank?
|
2016-01-12 15:18:40 +08:00
|
|
|
count = acts.count
|
2016-01-12 15:10:02 +08:00
|
|
|
puts project.id
|
2016-01-12 15:18:40 +08:00
|
|
|
puts "acts_count is #{count}"
|
|
|
|
project.update_attribute(:acts_count, count)
|
2016-01-12 15:10:02 +08:00
|
|
|
end
|
2016-01-12 10:38:50 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|