diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-08 14:49:27 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-05-08 14:49:27 +0000 |
commit | 533593e95cd3a922a2ec2ea43b345862361dfd67 (patch) | |
tree | b10219049cef0362978a51469a9869d4db303c18 /db/migrate/20130403003950_add_last_activity_column_into_project.rb | |
parent | 9e03f960fb94559c7972ceb69bf7c736660cb02d (diff) | |
parent | 15fcd9650f6a4a5832e2ed57419b11e30d3f606f (diff) | |
download | gitlab-ce-533593e95cd3a922a2ec2ea43b345862361dfd67.tar.gz |
Merge branch 'dz-squash-old-migrations' into 'master'
Squash migrations from 2013
See merge request gitlab-org/gitlab-ce!18547
Diffstat (limited to 'db/migrate/20130403003950_add_last_activity_column_into_project.rb')
-rw-r--r-- | db/migrate/20130403003950_add_last_activity_column_into_project.rb | 24 |
1 files changed, 0 insertions, 24 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 deleted file mode 100644 index 04a01612c6f..00000000000 --- a/db/migrate/20130403003950_add_last_activity_column_into_project.rb +++ /dev/null @@ -1,24 +0,0 @@ -# rubocop:disable all -class AddLastActivityColumnIntoProject < ActiveRecord::Migration - def up - add_column :projects, :last_activity_at, :datetime - add_index :projects, :last_activity_at - - select_all('SELECT id, updated_at FROM projects').each do |project| - project_id = project['id'] - update_date = project['updated_at'] - event = select_one("SELECT created_at FROM events WHERE project_id = #{project_id} ORDER BY created_at DESC LIMIT 1") - - if event && event['created_at'] - update_date = event['created_at'] - end - - execute("UPDATE projects SET last_activity_at = '#{update_date}' WHERE id = #{project_id}") - end - end - - def down - remove_index :projects, :last_activity_at - remove_column :projects, :last_activity_at - end -end |