We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3e63737 + ddd0511 commit 27b6685Copy full SHA for 27b6685
1 file changed
lib/tasks/rename_pending_changes_batch_id.rake
@@ -0,0 +1,15 @@
1
+# frozen_string_literal: true
2
+
3
+namespace :data_migration do
4
+ desc "Renames all the pending changes `batch_id`s to `batch_number`s"
5
+ task rename_pending_changes_batch_id: :environment do
6
+ VaccinationRecord
7
+ .where("pending_changes ? 'batch_id'")
8
+ .find_each do |record|
9
+ record.pending_changes["batch_number"] = record.pending_changes.delete(
10
+ "batch_id"
11
+ )
12
+ record.save!(touch: false)
13
+ end
14
15
+end
0 commit comments