eBooru/db/fixes/101_migrate_mod_actions.rb
Earlopain fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00

16 lines
429 B
Ruby
Executable File

#!/usr/bin/env ruby
# frozen_string_literal: true
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
ModAction.find_each do |p|
begin
p.values = p.values_old
p.save!(validate: false)
rescue Encoding::UndefinedConversionError => e
# Interacting with the model at all throws the exception again. Yay rails.
rescue => e
puts "#{p.id} has an exception"
end
end