Update all contact code to upcase

This commit is contained in:
Priit Tark 2015-05-05 14:22:44 +03:00
parent 4ea983c865
commit c704f4894a
5 changed files with 18 additions and 3 deletions

View file

@ -0,0 +1,14 @@
class UpcaseAllContactCodes < ActiveRecord::Migration
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

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150504110926) do
ActiveRecord::Schema.define(version: 20150505111437) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"