2016-01-12 10:38:50 +08:00
|
|
|
class StaticProjectAttachments < ActiveRecord::Migration
|
|
|
|
def up
|
|
|
|
Project.all.each do |project|
|
2016-01-12 15:10:02 +08:00
|
|
|
unless project.attachments.nil?
|
|
|
|
attachments_count = project.attachments.count
|
|
|
|
project.update_attribute(:attachments_count, attachments_count)
|
|
|
|
end
|
2016-01-12 10:38:50 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|