Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GeoWatch.remove_indexes
- GeoWatch.create_indexes
- Alert.remove_indexes
- Alert.create_indexes
- GeoWatch.unscoped.all.batch_size(100).each do |gw|
- print "GeoWatch[#{gw.id}] ... "
- alert_criteria = Alert.unscoped.where(geo_watch_id: gw.id)
- print "alert_count: #{alert_criteria.count} ... "
- if gw.state_active?
- alert_criteria.update_all(state_enum: Alert.state_active)
- puts "active"
- next
- end
- alert_criteria.update_all(state_enum: Alert.state_disabled)
- puts "DISABLED"
- end; "done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement