1 class AddObjectOwnerToLogs < ActiveRecord::Migration
2 include CurrentApiClient
5 add_column :logs, :object_owner_uuid, :string
7 Log.find_in_batches(:batch_size => 500) do |batch|
9 ActiveRecord::Base.transaction do
11 if log.properties["new_attributes"]
12 log.object_owner_uuid = log.properties['new_attributes']['owner_uuid']
14 elsif log.properties["old_attributes"]
15 log.object_owner_uuid = log.properties['old_attributes']['owner_uuid']
25 remove_column :logs, :object_owner_uuid