Merge branch 'master' of https://github.com/r888888888/danbooru
This commit is contained in:
@@ -4,12 +4,16 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config',
|
|||||||
|
|
||||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
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)
|
|
||||||
end ; true
|
|
||||||
|
|
||||||
Comment.find_each do |comment|
|
Comment.find_each do |comment|
|
||||||
if !Post.exists?("id = #{comment.post_id}")
|
if !Post.exists?("id = #{comment.post_id}")
|
||||||
comment.destroy
|
comment.destroy
|
||||||
end
|
end
|
||||||
end ; true
|
end ; true
|
||||||
|
|
||||||
|
Post.find_each do |post|
|
||||||
|
post.update_column(:fav_count, Favorite.where("post_id = #{post.id}").count)
|
||||||
|
end
|
||||||
|
|
||||||
|
Post.select("id, score, up_score, down_score, fav_count").find_each do |post|
|
||||||
|
post.update_column(:score, post.up_score + post.down_score)
|
||||||
|
end ; true
|
||||||
|
|||||||
Reference in New Issue
Block a user