Revert "Suppression de la clef "migrated": true
sur les filtres des ProcedurePresentation"
This commit is contained in:
parent
3283009be0
commit
6475cdff7a
3 changed files with 0 additions and 81 deletions
|
@ -1,25 +0,0 @@
|
|||
namespace :after_party do
|
||||
desc 'Deployment task: remove_migration_status_on_filters'
|
||||
task remove_migration_status_on_filters: :environment do
|
||||
rake_puts "Running deploy task 'remove_migration_status_on_filters'"
|
||||
|
||||
# In a9a4f6e2a801b19b127aae8eaec0d1f384b1a53a, a task to migrate ProcedurePresentation's filters
|
||||
# was added.
|
||||
# This task added a "migrated: true" key to all migrated filters.
|
||||
#
|
||||
# Now that this task has run, we can safely remove the extra key.
|
||||
|
||||
procedure_presentations = ProcedurePresentation.where("filters -> 'migrated' IS NOT NULL")
|
||||
progress = ProgressReport.new(procedure_presentations.count)
|
||||
|
||||
procedure_presentations.find_each do |pp|
|
||||
pp.filters.delete('migrated')
|
||||
pp.save!
|
||||
progress.inc
|
||||
end
|
||||
progress.finish
|
||||
|
||||
AfterParty::TaskRecord
|
||||
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
|
||||
end
|
||||
end
|
|
@ -15,17 +15,6 @@ def rake_print(*args)
|
|||
end
|
||||
end
|
||||
|
||||
# Display progress of a long-running Rake task.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# ```
|
||||
# progress = ProgressReport.new(100)
|
||||
# (0..100).times do
|
||||
# progress.inc
|
||||
# end
|
||||
# progress.finish
|
||||
# ````
|
||||
class ProgressReport
|
||||
def initialize(total)
|
||||
@start = Time.zone.now
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue