demarches-normaliennes/lib/tasks/deployment/20181210185634_remove_champ_pj_feature.rake
2018-12-18 11:11:23 +01:00

20 lines
543 B
Ruby

namespace :after_party do
desc 'Deployment task: remove_champ_pj_feature'
task remove_champ_pj_feature: :environment do
rake_puts "Running deploy task 'remove_champ_pj_feature'"
Administrateur.find_by_sql(
<<~SQL
SELECT administrateurs.*
FROM administrateurs, lateral jsonb_each(features)
WHERE key = 'champ_pj'
GROUP BY id
SQL
).each do |admin|
admin.features.delete('champ_pj')
admin.save
end
AfterParty::TaskRecord.create version: '20181210185634'
end
end