mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Add migration to remove points without coordinates
This commit is contained in:
parent
6ed9a27040
commit
045999b292
3 changed files with 21 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
:concurrency: <%= ENV.fetch("BACKGROUND_PROCESSING_CONCURRENCY", 100) %>
|
||||
:concurrency: <%= ENV.fetch("BACKGROUND_PROCESSING_CONCURRENCY", 10) %>
|
||||
:queues:
|
||||
- default
|
||||
- imports
|
||||
|
|
|
|||
19
db/data/20240610170930_remove_points_without_coordinates.rb
Normal file
19
db/data/20240610170930_remove_points_without_coordinates.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemovePointsWithoutCoordinates < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
points = Point.where('longitude = 0.0 OR latitude = 0.0')
|
||||
|
||||
Rails.logger.info "Found #{points.count} points without coordinates..."
|
||||
|
||||
points
|
||||
.select { |point| point.raw_data['latitudeE7'].nil? && point.raw_data['longitudeE7'].nil? }
|
||||
.each(&:destroy)
|
||||
|
||||
Rails.logger.info 'Points without coordinates removed.'
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
@ -1 +1 @@
|
|||
DataMigrate::Data.define(version: 20240525110530)
|
||||
DataMigrate::Data.define(version: 20240610170930)
|
||||
|
|
|
|||
Loading…
Reference in a new issue