Browse Source
* CLDC-2895 Don't validate entities being updated in rake task * CLDC-2895 Capture exceptions raised while saving and send them to Sentrypull/2011/head
David May-Miller
1 year ago
committed by
GitHub
1 changed files with 24 additions and 8 deletions
@ -1,19 +1,35 @@
|
||||
desc "Squish names of locations, schemes, users, and organisations" |
||||
task squish_names: :environment do |
||||
Location.find_each do |location| |
||||
Location.where("name LIKE ?", "% %").each do |location| |
||||
location.name&.squish! |
||||
begin |
||||
location.save! |
||||
rescue StandardError => e |
||||
Sentry.capture_exception(e) |
||||
end |
||||
Scheme.find_each do |scheme| |
||||
end |
||||
Scheme.where("service_name LIKE ?", "% %").each do |scheme| |
||||
scheme.service_name&.squish! |
||||
begin |
||||
scheme.save! |
||||
rescue StandardError => e |
||||
Sentry.capture_exception(e) |
||||
end |
||||
end |
||||
User.find_each do |user| |
||||
User.where("name LIKE ?", "% %").each do |user| |
||||
user.name&.squish! |
||||
begin |
||||
user.save! |
||||
rescue StandardError => e |
||||
Sentry.capture_exception(e) |
||||
end |
||||
Organisation.find_each do |organisation| |
||||
end |
||||
Organisation.where("name LIKE ?", "% %").each do |organisation| |
||||
organisation.name&.squish! |
||||
begin |
||||
organisation.save! |
||||
rescue StandardError => e |
||||
Sentry.capture_exception(e) |
||||
end |
||||
end |
||||
end |
||||
|
Loading…
Reference in new issue