remove expensive join in migration

This commit is contained in:
r888888888
2014-01-03 16:33:58 -08:00
parent e814b7a6bf
commit 08b245a7bd

View File

@@ -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