diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-09 20:58:47 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-09 20:58:47 +0300 |
commit | 4496a747c669611e35d758c994ed7ee9a235985a (patch) | |
tree | 87ba6bc84d22cb409cc77f7409d6cadb8f6c3b6b /db | |
parent | ae2233b1149392d63c6fa4ede8a58b7d82d7790c (diff) | |
download | gitlab-ce-4496a747c669611e35d758c994ed7ee9a235985a.tar.gz |
Improve migration AddLastActivityColumnIntoProject to use real last activity date if present
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20130403003950_add_last_activity_column_into_project.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/db/migrate/20130403003950_add_last_activity_column_into_project.rb b/db/migrate/20130403003950_add_last_activity_column_into_project.rb index ddb04843de1..2a036bd9993 100644 --- a/db/migrate/20130403003950_add_last_activity_column_into_project.rb +++ b/db/migrate/20130403003950_add_last_activity_column_into_project.rb @@ -4,7 +4,13 @@ class AddLastActivityColumnIntoProject < ActiveRecord::Migration add_index :projects, :last_activity_at 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 |