Commit 4496a747 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve migration AddLastActivityColumnIntoProject to use real last activity date if present

parent ae2233b1
...@@ -4,7 +4,13 @@ class AddLastActivityColumnIntoProject < ActiveRecord::Migration ...@@ -4,7 +4,13 @@ class AddLastActivityColumnIntoProject < ActiveRecord::Migration
add_index :projects, :last_activity_at add_index :projects, :last_activity_at
Project.find_each do |project| Project.find_each do |project|
project.update_attribute(:last_activity_at, project.last_activity_date) last_activity_date = if project.last_activity
project.last_activity.created_at
else
project.updated_at
end
project.update_attribute(:last_activity_at, last_activity_date)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment