Skip to content

Commit

Permalink
Improve info logs as per suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: Joan Lledó <[email protected]>
  • Loading branch information
mayorova and jlledom committed Sep 16, 2024
1 parent ee9e0a8 commit 4d3c822
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/tasks/multitenant/tenants.rake
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ namespace :multitenant do
orphaned_objects = model.where.not(tenant_id: provider_account_ids)

if orphaned_objects.exists?
puts "Found orphaned objects in #{model.table_name}:"
puts "Found orphaned objects for model #{model.name}:"
orphaned_objects.find_each { |obj| puts "- ID: #{obj.id}, Tenant ID: #{obj.tenant_id}" }

if destroy
puts "Destroying orphan #{model.table_name}..."
puts "Destroying orphaned objects for model #{model.name}..."
orphaned_objects.in_batches(of: 100).destroy_all
end
else
puts "No orphaned objects found in #{model.table_name}."
puts "No orphaned objects found for model #{model.name}."
end
end

Expand Down

0 comments on commit 4d3c822

Please sign in to comment.