Skip to content

Commit

Permalink
fix(delete_orphaned_champs): maintenance tasks with custom PG_STATEME…
Browse files Browse the repository at this point in the history
…NT_TIMEOUT is not a good fit. change implementation to after_party
  • Loading branch information
mfo committed Aug 27, 2024
1 parent 0771d20 commit 6696a3e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 80 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace :after_party do
desc 'Deployment task: delete_orphaned_champs_with_missing_dossier'
task delete_orphaned_champs_with_missing_dossier: :environment do
puts "Running deploy task 'delete_orphaned_champs_with_missing_dossier'"

Champ.select(:id, :type).where.missing(:dossier).each do |champ|
champ.champs.destroy_all if champ.type == 'Champs::RepetitionChamp'
champ.destroy
end

# Update task as completed. If you remove the line below, the task will
# run with every deploy (or every time you call after_party:run).
AfterParty::TaskRecord
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end

This file was deleted.

0 comments on commit 6696a3e

Please sign in to comment.