fix(geo_area): geo_area.geometry must be valid JSON, not nil

This commit is contained in:
Colin Darie 2023-02-08 16:44:53 +01:00
parent a3bf94e431
commit 2c1465a8cc
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -0,0 +1,18 @@
namespace :after_party do
desc 'Deployment task: fix_geo_area_without_geometry'
task fix_geo_area_without_geometry: :environment do
puts "Running deploy task 'fix_geo_area_without_geometry'"
geo_areas = GeoArea.where(geometry: nil)
geo_areas.find_each do |geo_area|
geo_area.geometry = {}
geo_area.save!
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: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end