Skip to content

Commit b1898bb

Browse files
committed
Remove migration rake task
This task only needed to be run once and will no longer applicable/
1 parent 1327c92 commit b1898bb

1 file changed

Lines changed: 0 additions & 26 deletions

File tree

lib/tasks/submissions.rake

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,6 @@ namespace :submissions do
55
Rails.logger.info "#{Submission.bounced.count} bounced submissions"
66
end
77

8-
# TODO: Remove this task after mail_status and sent_at are removed from the database
9-
desc "Sync mail_status to delivery_status and sent_at to last_delivery_attempt"
10-
task migrate_mail_status_to_delivery_status: :environment do
11-
Rails.logger.info "Starting sync of mail_status to delivery_status and sent_at to last_delivery_attempt"
12-
13-
updated_count = 0
14-
15-
Submission.find_each do |submission|
16-
update_attrs = {}
17-
18-
# Map mail_status to delivery_status
19-
expected_delivery_status = "delivery_#{submission.mail_status}"
20-
21-
update_attrs[:delivery_status] = expected_delivery_status if submission.delivery_status != expected_delivery_status
22-
update_attrs[:last_delivery_attempt] = submission.sent_at if submission.last_delivery_attempt != submission.sent_at
23-
24-
# Only update if there are changes
25-
if update_attrs.any?
26-
submission.update!(update_attrs)
27-
updated_count += 1
28-
end
29-
end
30-
31-
Rails.logger.info "Sync completed. Updated #{updated_count} submissions."
32-
end
33-
348
desc "Fetch and display all data for a specific submission given a reference"
359
task :inspect_submission_data, [:reference] => :environment do |_t, args|
3610
submission = Submission.find_by(reference: args.reference)

0 commit comments

Comments
 (0)