1 class TileTracepoints < ActiveRecord::Migration[4.2]
2 class Tracepoint < ApplicationRecord
3 self.table_name = "gps_points"
7 add_column "gps_points", "tile", :bigint
8 add_index "gps_points", ["tile"], :name => "points_tile_idx"
9 remove_index "gps_points", :name => "points_idx"
11 Tracepoint.all.each do |tp|
12 tp.latitude = tp.latitude * 10
13 tp.longitude = tp.longitude * 10
19 Tracepoint.update_all("latitude = latitude / 10, longitude = longitude / 10")
21 add_index "gps_points", %w[latitude longitude], :name => "points_idx"
22 remove_index "gps_points", :name => "points_tile_idx"
23 remove_column "gps_points", "tile"