This commit is contained in:
r888888888
2013-04-19 15:35:36 -07:00
parent a7b6dd6de0
commit d2f2a142b9
2 changed files with 9 additions and 3 deletions

View File

@@ -5,5 +5,11 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config',
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
Post.select("id, score, up_score, down_score, fav_count").find_each do |post|
post.update_column(:score, post.up_score - post.down_score + post.fav_count)
post.update_column(:score, post.up_score + post.down_score + post.fav_count)
end
Comment.find_each do |comment|
if !Post.exists?("id = #{comment.post_id}")
comment.destroy
end
end