Merge pull request #7870 from mfo/US/fix-champs-and-type-de-champs-without-revision
fix(type_de_champ.donnée): supprime les orphelins des tables type_de_champs et champs n'étant pas rattaché à une révision et étant attaché à un dossier
This commit is contained in:
commit
978a4c7713
1 changed files with 14 additions and 0 deletions
|
@ -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
|
Loading…
Add table
Reference in a new issue