]> git.openstreetmap.org Git - rails.git/blobdiff - db/migrate/20180204153242_tile_users.rb
Bump @eslint/plugin-kit from 0.2.0 to 0.2.3
[rails.git] / db / migrate / 20180204153242_tile_users.rb
index 61dbcb4ea59fd63a69d0eaf6691a9462ad5328f7..53cea91cf552b61ed9db820f1ea989bf8dfef586 100644 (file)
@@ -1,16 +1,12 @@
 class TileUsers < ActiveRecord::Migration[5.1]
-  class User < ActiveRecord::Base
+  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