Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/tasks/data_migrations.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

namespace :data_migrations do
desc "Fix vaccination record locations where both location_id and location_name is set"
task fix_vaccination_record_locations: :environment do
vaccination_records =
VaccinationRecord
.where.not(location_id: nil)
.where.not(location_name: nil)

puts "#{vaccination_records.count} vaccination records need fixing"

vaccination_records.update_all(location_id: nil)
end
end