3 class TileTracepoints < ActiveRecord::Migration
5 add_column "gps_points", "tile", :bigint
6 add_index "gps_points", ["tile"], :name => "points_tile_idx"
7 remove_index "gps_points", :name => "points_idx"
9 if ENV["USE_DB_FUNCTIONS"]
10 Tracepoint.update_all("latitude = latitude * 10, longitude = longitude * 10, tile = tile_for_point(latitude * 10, longitude * 10)")
12 Tracepoint.all.each do |tp|
13 tp.latitude = tp.latitude * 10
14 tp.longitude = tp.longitude * 10
21 Tracepoint.update_all("latitude = latitude / 10, longitude = longitude / 10")
23 add_index "gps_points", %w(latitude longitude), :name => "points_idx"
24 remove_index "gps_points", :name => "points_tile_idx"
25 remove_column "gps_points", "tile"