20180711080554_issue_2100_utf8_encode_http_logs.rb 452 B

1234567891011
  1. class Issue2100Utf8EncodeHttpLogs < ActiveRecord::Migration[5.1]
  2. def up
  3. HttpLog.where('request LIKE :enctag OR response LIKE :enctag', enctag: '%content: !binary |%')
  4. .limit(100_000)
  5. .order(created_at: :desc)
  6. .find_each do |log|
  7. log.update(request: log.request.transform_values(&:utf8_encode),
  8. response: log.response.transform_values(&:utf8_encode))
  9. end
  10. end
  11. end