Step1 : add new column to Assign_tos and make sure that the data is saved on form submit

This commit is contained in:
kara Diaby 2020-02-18 17:18:25 +01:00
parent bc1c085e5e
commit 5dc5230791
5 changed files with 29 additions and 1 deletions

View file

@ -0,0 +1,16 @@
namespace :after_party do
desc 'Deployment task: backfill_daily_email_notification_columns'
task backfill_daily_email_notification_columns: :environment do
puts "Running deploy task 'backfill_daily_email_notification_columns'"
AssignTo.find_each do |assign_to|
columns_to_update = {}
if assign_to.email_notifications_enabled != assign_to.daily_email_notifications_enabled
columns_to_update[:daily_email_notifications_enabled] = assign_to.email_notifications_enabled
end
assign_to.update_columns(columns_to_update) unless columns_to_update.empty?
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: '20200220142710'
end # task :backfill_daily_email_notification_columns
end # namespace :after_party