Merge pull request #5841 from betagouv/skip_content_validation_for_old_pj
add task to skip content type validation for old pj
This commit is contained in:
commit
28623fb892
1 changed files with 18 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
namespace :after_party do
|
||||
desc 'Deployment task: add_default_skip_content_type_validation_to_piece_justificative'
|
||||
task add_default_skip_content_type_validation_to_piece_justificative: :environment do
|
||||
puts "Running deploy task 'add_default_skip_content_type_validation_to_piece_justificative'"
|
||||
tdcs = TypeDeChamp.where(type_champ: TypeDeChamp.type_champs.fetch(:piece_justificative))
|
||||
progress = ProgressReport.new(tdcs.count)
|
||||
tdcs.find_each do |tdc|
|
||||
tdc.update(skip_content_type_pj_validation: true)
|
||||
progress.inc
|
||||
end
|
||||
progress.finish
|
||||
|
||||
# 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…
Reference in a new issue