From 08b245a7bd842e2030547ef7031cf76ef2d4bd3f Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 3 Jan 2014 16:33:58 -0800 Subject: [PATCH] remove expensive join in migration --- .../20131225002748_add_last_comment_bumped_at_to_posts.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/migrate/20131225002748_add_last_comment_bumped_at_to_posts.rb b/db/migrate/20131225002748_add_last_comment_bumped_at_to_posts.rb index 69d93f86a..f426c8499 100644 --- a/db/migrate/20131225002748_add_last_comment_bumped_at_to_posts.rb +++ b/db/migrate/20131225002748_add_last_comment_bumped_at_to_posts.rb @@ -7,9 +7,9 @@ class AddLastCommentBumpedAtToPosts < ActiveRecord::Migration add_column :posts, :last_commented_at, :datetime - Post.joins(:comments).uniq.find_each do |post| - post.update_column(:last_commented_at, post.comments.last.created_at) - end + # Post.joins(:comments).uniq.find_each do |post| + # post.update_column(:last_commented_at, post.comments.last.created_at) + # end add_column :comments, :do_not_bump_post, :boolean, :null => false, :default => false end