X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a70b61315c2331c18123a0b36782d6ef6bb3ab3e..65d57a5bfaae7e663d0a3e8d28186fb58ca452a7:/db/migrate/004_user_enhancements.rb diff --git a/db/migrate/004_user_enhancements.rb b/db/migrate/004_user_enhancements.rb index af4b65123..68c6cd1de 100644 --- a/db/migrate/004_user_enhancements.rb +++ b/db/migrate/004_user_enhancements.rb @@ -1,24 +1,24 @@ -require 'migrate' +require "migrate" -class UserEnhancements < ActiveRecord::Migration +class UserEnhancements < ActiveRecord::Migration[5.0] def self.up - add_column "diary_entries", "latitude", :double - add_column "diary_entries", "longitude", :double + add_column "diary_entries", "latitude", :float, :limit => 53 + add_column "diary_entries", "longitude", :float, :limit => 53 add_column "diary_entries", "language", :string, :limit => 3 - create_table "user_preferences", innodb_table do |t| - t.column "user_id", :bigint, :limit => 20, :null => false - t.column "k", :string, :null => false - t.column "v", :string, :null => false + create_table "user_preferences", :id => false do |t| + t.column "user_id", :bigint, :null => false + t.column "k", :string, :null => false + 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", innodb_table do |t| - t.column "id", :bigint_pk, :null => false - t.column "user_id", :bigint, :limit => 20, :null => false - t.column "token", :string, :null => false - t.column "expiry", :datetime, :null => false + create_table "user_tokens", :id => false do |t| + t.column "id", :bigserial, :primary_key => true, :null => false + t.column "user_id", :bigint, :null => false + t.column "token", :string, :null => false + t.column "expiry", :datetime, :null => false end add_index "user_tokens", ["token"], :name => "user_tokens_token_idx", :unique => true @@ -35,14 +35,14 @@ 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 remove_column "users", "pass_salt" remove_column "users", "nearby" - add_column "users", "within_lat", :double - add_column "users", "within_lon", :double + add_column "users", "within_lat", :float, :limit => 53 + add_column "users", "within_lon", :float, :limit => 53 add_column "users", "timeout", :datetime add_column "users", "token", :string