internetee-registry/db/migrate/20150505111437_upcase_all_contact_codes.rb
2021-04-26 18:54:26 +05:00

14 lines
333 B
Ruby

class UpcaseAllContactCodes < ActiveRecord::Migration[6.0]
def change
puts 'Update contact code to upcase...'
@i = 0
puts @i
Contact.find_in_batches(batch_size: 10000) do |batch|
batch.each do |c|
c.update_column(:code, c.code.upcase)
end
GC.start
puts @i += 10000
end
end
end