trabajo-afectivo/db/migrate/20180711080554_issue_2100_utf8_encode_http_logs.rb
2022-01-01 14:38:12 +01:00

13 lines
529 B
Ruby

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
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