Skip to content

Commit

Permalink
[POD_1795] populate new serialized fields
Browse files Browse the repository at this point in the history
  • Loading branch information
aploshay committed Jul 22, 2022
1 parent 05b6bea commit 2f2a911
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions db/migrate/20220721194158_populate_serialized_fields.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class PopulateSerializedFields < ActiveRecord::Migration
def up
puts "Populating MemnonInvoiceSubmission: #{MemnonInvoiceSubmission.count}"
MemnonInvoiceSubmission.find_in_batches.with_index do |group, batch|
puts "processing batch #{batch}"
group.each_with_index do |mis, i|
puts "#{i+1}: #{mis.id}"
mis.problems_by_row_json = mis.problems_by_row
mis.save!
end
end
puts "Populating DigitalStatus: #{DigitalStatus.count}"
DigitalStatus.find_in_batches.with_index do |group, batch|
puts "processing batch #{batch}"
group.each_with_index do |ds, i|
puts "#{i+1}: #{ds.id}"
ds.options_json = ds.options
ds.save!
end
end
end
def down
puts "no action on rollback"
end
end

0 comments on commit 2f2a911

Please sign in to comment.