migrate(dossier): fill hidden_by_administration_at and hidden_by_user_at from hidden_at

This commit is contained in:
Paul Chavard 2022-03-09 11:32:22 +01:00
parent 6ae901fd41
commit bcbcd11c42

View file

@ -0,0 +1,16 @@
namespace :after_party do
desc 'Deployment task: seed_hidden_at_dossiers'
task seed_hidden_at_dossiers: :environment do
puts "Running deploy task 'seed_hidden_at_dossiers'"
Dossier
.where.not(hidden_at: nil)
.where(hidden_by_user_at: nil, hidden_by_administration_at: nil)
.update_all('hidden_by_user_at = hidden_at, hidden_by_administration_at = hidden_at')
# 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