fixes #1396, fix tests
This commit is contained in:
@@ -23,16 +23,6 @@ Artist.where("is_banned = true").find_each do |artist|
|
||||
artist.versions.last.update_column(:is_banned, true)
|
||||
end ; true
|
||||
|
||||
User.find_each do |user|
|
||||
puts "updating user #{user.id}"
|
||||
user.update_column(:favorite_count, Favorite.for_user(user).where("user_id = ?", user.id).count)
|
||||
end ; true
|
||||
|
||||
Post.find_each do |post|
|
||||
puts "updating post #{post.id}"
|
||||
post.update_column(:fav_count, Favorite.where("post_id = #{post.id}").count)
|
||||
end ; true
|
||||
|
||||
danbooru_conn = PGconn.connect(dbname: 'danbooru')
|
||||
danbooru2_conn = PGconn.connect(dbname: "danbooru2")
|
||||
danbooru_conn.exec("set statement_timeout = 0")
|
||||
@@ -42,9 +32,3 @@ danbooru_conn.exec( "SELECT * FROM comments WHERE id < 29130" ) do |result|
|
||||
danbooru2_conn.exec "insert into comments (id, created_at, updated_at, post_id, creator_id, body, ip_addr, score, updater_id, updater_ip_addr) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", [row["id"], row["created_at"], row["created_at"], row["post_id"], row["user_id"], row["body"], row["ip_addr"], row["score"], row["user_id"], row["ip_addr"]]
|
||||
end
|
||||
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
|
||||
|
||||
|
||||
15
script/fixes/014_note_ranges.rb
Normal file
15
script/fixes/014_note_ranges.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
|
||||
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||
|
||||
Note.update_all("x = 0", "x < 0")
|
||||
Note.update_all("y = 0", "y < 0")
|
||||
Note.update_all("x = 0", "x > (select _.image_width from posts _ where _.id = notes.id limit 1)")
|
||||
Note.update_all("y = 0", "y > (select _.image_height from posts _ where _.id = notes.id limit 1)")
|
||||
|
||||
Post.where("created_at >= '2013-02-01'").select("id, score, up_score, down_score").find_each do |post|
|
||||
fav_count =
|
||||
post.update_column(:score, post.up_score + post.down_score)
|
||||
end ; true
|
||||
Reference in New Issue
Block a user