Add migration service and task
This commit is contained in:
parent
9de917592b
commit
bc09b61684
3 changed files with 83 additions and 0 deletions
22
lib/tasks/deployment/20200625113026_migrate_revisions.rake
Normal file
22
lib/tasks/deployment/20200625113026_migrate_revisions.rake
Normal file
|
@ -0,0 +1,22 @@
|
|||
namespace :after_party do
|
||||
desc 'Deployment task: migrate_revisions'
|
||||
task migrate_revisions: :environment do
|
||||
puts "Running deploy task 'migrate_revisions'"
|
||||
|
||||
procedures = Procedure.with_discarded.where(draft_revision_id: nil)
|
||||
progress = ProgressReport.new(procedures.count)
|
||||
|
||||
puts "Processing procedures"
|
||||
procedures.find_each do |procedure|
|
||||
RevisionsMigration.add_revisions(procedure)
|
||||
progress.inc
|
||||
end
|
||||
progress.finish
|
||||
|
||||
TmpDossiersMigrateRevisionsJob.perform_later([])
|
||||
|
||||
# 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: '20200625113026'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue