From 285c7d704a29c29e1276803b9e5c5b29d6c27302 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 7 Oct 2022 11:08:36 +0200 Subject: [PATCH] fix(type_de_champ.data): drop former orphan from type_de_champ and champ without coordinates --- ..._champs_and_type_de_champ_with_no_revision.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/tasks/deployment/20221007085741_clean_champs_and_type_de_champ_with_no_revision.rake diff --git a/lib/tasks/deployment/20221007085741_clean_champs_and_type_de_champ_with_no_revision.rake b/lib/tasks/deployment/20221007085741_clean_champs_and_type_de_champ_with_no_revision.rake new file mode 100644 index 000000000..5b3ca3875 --- /dev/null +++ b/lib/tasks/deployment/20221007085741_clean_champs_and_type_de_champ_with_no_revision.rake @@ -0,0 +1,14 @@ +namespace :after_party do + desc 'Deployment task: clean_champs_and_type_de_champ_with_no_revision' + task clean_champs_and_type_de_champ_with_no_revision: :environment do + puts "Running deploy task 'clean_champs_and_type_de_champ_with_no_revision'" + + champs = Champ.where(type_de_champ: TypeDeChamp.where.missing(:revisions)) + TypeDeChamp.where(id: champs.map(&:type_de_champ_id)).destroy_all + + # 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