1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class AddObjectOwnerToLogs < ActiveRecord::Migration
6 include CurrentApiClient
9 add_column :logs, :object_owner_uuid, :string
11 Log.find_in_batches(:batch_size => 500) do |batch|
13 ActiveRecord::Base.transaction do
15 if log.properties["new_attributes"]
16 log.object_owner_uuid = log.properties['new_attributes']['owner_uuid']
18 elsif log.properties["old_attributes"]
19 log.object_owner_uuid = log.properties['old_attributes']['owner_uuid']
29 remove_column :logs, :object_owner_uuid