Migrate procedures archivee to close
This commit is contained in:
parent
b29b6176c9
commit
ee7df3d5cf
1 changed files with 15 additions and 0 deletions
15
lib/tasks/deployment/20191114084623_archivee_to_close.rake
Normal file
15
lib/tasks/deployment/20191114084623_archivee_to_close.rake
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: archivee_to_close'
|
||||||
|
task archivee_to_close: :environment do
|
||||||
|
puts "Running deploy task 'archivee_to_close'"
|
||||||
|
|
||||||
|
Procedure.where(aasm_state: :archivee).update_all(aasm_state: :close)
|
||||||
|
Procedure.where(aasm_state: :close, closed_at: nil).find_each do |procedure|
|
||||||
|
procedure.update_column(:closed_at, procedure.archived_at)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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: '20191114084623'
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue