Permalink
Browse files

Add migration to retroactively convert HttpLogs to UTF8

  • Loading branch information...
rlue committed Jul 11, 2018
1 parent 680a560 commit f041fef7ff50083416827b7bc2f7f9697547f7ea
Showing with 11 additions and 0 deletions.
  1. +11 −0 db/migrate/20180711080554_issue_2100_utf8_encode_http_logs.rb
@@ -0,0 +1,11 @@
class Issue2100Utf8EncodeHttpLogs < ActiveRecord::Migration[5.1]
def up
HttpLog.where('request LIKE :enctag OR response LIKE :enctag', enctag: '%content: !binary |%')
.limit(100_000)
.order(created_at: :desc)
.find_each do |log|
log.update(request: log.request.transform_values(&:utf8_encode),
response: log.response.transform_values(&:utf8_encode))
end
end
end

0 comments on commit f041fef

Please sign in to comment.