20210510092410_issue_3550_set_pretty.rb 382 B

123456789101112
  1. class Issue3550SetPretty < ActiveRecord::Migration[5.2]
  2. def change
  3. return if !Setting.exists?(name: 'system_init_done')
  4. Cti::Log.order(created_at: :desc).limit(300).find_each do |log|
  5. log.set_pretty
  6. log.save!
  7. rescue
  8. Rails.logger.error "Issue3550SetPretty: Failed to migrate id #{log.id} with from '#{log.from}' and to '#{log.to}'"
  9. end
  10. end
  11. end