X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ac7bb003ec9726d23d0a537f347c2dd4c8f7204a..a44818f979575fb4a315dd344244137a3bfdaf62:/db/migrate/004_user_enhancements.rb diff --git a/db/migrate/004_user_enhancements.rb b/db/migrate/004_user_enhancements.rb index 8b352be3e..5d3bc4858 100644 --- a/db/migrate/004_user_enhancements.rb +++ b/db/migrate/004_user_enhancements.rb @@ -1,6 +1,4 @@ -require 'migrate' - -class UserEnhancements < ActiveRecord::Migration +class UserEnhancements < ActiveRecord::Migration[4.2] def self.up add_column "diary_entries", "latitude", :float, :limit => 53 add_column "diary_entries", "longitude", :float, :limit => 53 @@ -12,7 +10,7 @@ class UserEnhancements < ActiveRecord::Migration t.column "v", :string, :null => false end - add_primary_key "user_preferences", ["user_id", "k"] + add_primary_key "user_preferences", %w[user_id k] create_table "user_tokens", :id => false do |t| t.column "id", :bigserial, :primary_key => true, :null => false @@ -24,7 +22,7 @@ class UserEnhancements < ActiveRecord::Migration add_index "user_tokens", ["token"], :name => "user_tokens_token_idx", :unique => true add_index "user_tokens", ["user_id"], :name => "user_tokens_user_id_idx" - User.where("token is not null").each do |user| + User.where.not(:token => nil).each do |user| UserToken.create(:user_id => user.id, :token => user.token, :expiry => 1.week.from_now) end @@ -35,7 +33,7 @@ class UserEnhancements < ActiveRecord::Migration add_column "users", "nearby", :integer, :default => 50 add_column "users", "pass_salt", :string - User.update_all("nearby = 50"); + User.update_all("nearby = 50") end def self.down