3 class TileTracepoints < ActiveRecord::Migration[4.2]
4 class Tracepoint < ApplicationRecord
5 self.table_name = "gps_points"
9 add_column "gps_points", "tile", :bigint
10 add_index "gps_points", ["tile"], :name => "points_tile_idx"
11 remove_index "gps_points", :name => "points_idx"
13 if ENV["USE_DB_FUNCTIONS"]
14 Tracepoint.update_all("latitude = latitude * 10, longitude = longitude * 10, tile = tile_for_point(latitude * 10, longitude * 10)")
16 Tracepoint.all.each do |tp|
17 tp.latitude = tp.latitude * 10
18 tp.longitude = tp.longitude * 10
25 Tracepoint.update_all("latitude = latitude / 10, longitude = longitude / 10")
27 add_index "gps_points", %w[latitude longitude], :name => "points_idx"
28 remove_index "gps_points", :name => "points_tile_idx"
29 remove_column "gps_points", "tile"