* Wrap it into a transaction * Use destroy over delete so dependent destroys get triggered and we thus don't fail on the foreign key constraits * Check if a photos status message actually exists before accessing it * Add missing dependent destroys
15 lines
347 B
Ruby
15 lines
347 B
Ruby
namespace :accounts do
|
|
desc "Run deletions"
|
|
task :run_deletions => :environment do
|
|
if ::AccountDeletion.count > 0
|
|
puts "Running account deletions.."
|
|
::AccountDeletion.find_each do |account_delete|
|
|
account_delete.perform!
|
|
end
|
|
puts "OK."
|
|
else
|
|
puts "No acccount deletions to run."
|
|
end
|
|
end
|
|
|
|
end
|