Merge pull request #7017 from tchak/migration-dossiers-deleted-scopes

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 17:47:43 +01:00 committed by GitHub
commit bda6f81528
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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