Files
danbooru/db/migrate/20130322162059_add_is_banned_to_posts.rb
albert 6c54d89a36 * All users can now view deleted posts.
* Posts now have an is_banned flag for artist removal requests.  Basic users can not view banned posts but gold and higher can.
* Banning an artist both deletes the post and bans it.
* By default deleted posts are not filtered out of post searches at the sql level.
2013-03-22 09:38:53 -07:00

15 lines
502 B
Ruby

class AddIsBannedToPosts < ActiveRecord::Migration
def up
execute("set statement_timeout = 0")
add_column :posts, :is_banned, :boolean, :null => false, :default => false
Artist.banned.each do |artist|
Post.raw_tag_match(artist.name).each do |post|
post.update_column(:is_banned, true)
end
end
PostFlag.where("reason ilike '%requested%' and reason <> 'Artist requested removal'").each do |flag|
flag.post.update_column(:is_banned, true)
end
end
end