3 class UserEnhancements < ActiveRecord::Migration[4.2]
5 add_column "diary_entries", "latitude", :float, :limit => 53
6 add_column "diary_entries", "longitude", :float, :limit => 53
7 add_column "diary_entries", "language", :string, :limit => 3
9 create_table "user_preferences", :id => false do |t|
10 t.column "user_id", :bigint, :null => false
11 t.column "k", :string, :null => false
12 t.column "v", :string, :null => false
15 add_primary_key "user_preferences", %w[user_id k]
17 create_table "user_tokens", :id => false do |t|
18 t.column "id", :bigserial, :primary_key => true, :null => false
19 t.column "user_id", :bigint, :null => false
20 t.column "token", :string, :null => false
21 t.column "expiry", :datetime, :null => false
24 add_index "user_tokens", ["token"], :name => "user_tokens_token_idx", :unique => true
25 add_index "user_tokens", ["user_id"], :name => "user_tokens_user_id_idx"
27 User.where.not(:token => nil).each do |user|
28 UserToken.create(:user_id => user.id, :token => user.token, :expiry => 1.week.from_now)
31 remove_column "users", "token"
32 remove_column "users", "timeout"
33 remove_column "users", "within_lon"
34 remove_column "users", "within_lat"
35 add_column "users", "nearby", :integer, :default => 50
36 add_column "users", "pass_salt", :string
38 User.update_all("nearby = 50")
42 remove_column "users", "pass_salt"
43 remove_column "users", "nearby"
44 add_column "users", "within_lat", :float, :limit => 53
45 add_column "users", "within_lon", :float, :limit => 53
46 add_column "users", "timeout", :datetime
47 add_column "users", "token", :string
49 drop_table "user_tokens"
51 drop_table "user_preferences"
53 remove_column "diary_entries", "language"
54 remove_column "diary_entries", "longitude"
55 remove_column "diary_entries", "latitude"