remove expensive join in migration
This commit is contained in:
@@ -7,9 +7,9 @@ class AddLastCommentBumpedAtToPosts < ActiveRecord::Migration
|
|||||||
|
|
||||||
add_column :posts, :last_commented_at, :datetime
|
add_column :posts, :last_commented_at, :datetime
|
||||||
|
|
||||||
Post.joins(:comments).uniq.find_each do |post|
|
# Post.joins(:comments).uniq.find_each do |post|
|
||||||
post.update_column(:last_commented_at, post.comments.last.created_at)
|
# post.update_column(:last_commented_at, post.comments.last.created_at)
|
||||||
end
|
# end
|
||||||
|
|
||||||
add_column :comments, :do_not_bump_post, :boolean, :null => false, :default => false
|
add_column :comments, :do_not_bump_post, :boolean, :null => false, :default => false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user