X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f1e9dcc66af1945cc0b8847b4ccecde9f54520ba..a33174acb8ebf4cff67281889ceca940b6b5a48b:/db/migrate/20180204153242_tile_users.rb?ds=inline diff --git a/db/migrate/20180204153242_tile_users.rb b/db/migrate/20180204153242_tile_users.rb index cf20aed46..53cea91cf 100644 --- a/db/migrate/20180204153242_tile_users.rb +++ b/db/migrate/20180204153242_tile_users.rb @@ -1,13 +1,12 @@ class TileUsers < ActiveRecord::Migration[5.1] + class User < ApplicationRecord + end + def up add_column :users, :home_tile, :bigint add_index :users, [:home_tile], :name => "users_home_idx" - if ENV["USE_DB_FUNCTIONS"] - User.update_all("home_tile = tile_for_point(cast(round(home_lat * #{GeoRecord::SCALE}) as integer), cast(round(home_lon * #{GeoRecord::SCALE}) as integer))") - else - User.all.each(&:save!) - end + User.all.each(&:save!) end def down