1 class UserEnhancements < ActiveRecord::Migration[4.2]
3 add_column "diary_entries", "latitude", :float, :limit => 53
4 add_column "diary_entries", "longitude", :float, :limit => 53
5 add_column "diary_entries", "language", :string, :limit => 3
7 create_table "user_preferences", :id => false do |t|
8 t.column "user_id", :bigint, :null => false
9 t.column "k", :string, :null => false
10 t.column "v", :string, :null => false
13 add_primary_key "user_preferences", %w[user_id k]
15 create_table "user_tokens", :id => false do |t|
16 t.column "id", :bigserial, :primary_key => true, :null => false
17 t.column "user_id", :bigint, :null => false
18 t.column "token", :string, :null => false
19 t.column "expiry", :datetime, :null => false
22 add_index "user_tokens", ["token"], :name => "user_tokens_token_idx", :unique => true
23 add_index "user_tokens", ["user_id"], :name => "user_tokens_user_id_idx"
25 User.where.not(:token => nil).each do |user|
26 UserToken.create(:user_id => user.id, :token => user.token, :expiry => 1.week.from_now)
29 remove_column "users", "token"
30 remove_column "users", "timeout"
31 remove_column "users", "within_lon"
32 remove_column "users", "within_lat"
33 add_column "users", "nearby", :integer, :default => 50
34 add_column "users", "pass_salt", :string
36 User.update_all("nearby = 50")
40 remove_column "users", "pass_salt"
41 remove_column "users", "nearby"
42 add_column "users", "within_lat", :float, :limit => 53
43 add_column "users", "within_lon", :float, :limit => 53
44 add_column "users", "timeout", :datetime
45 add_column "users", "token", :string
47 drop_table "user_tokens"
49 drop_table "user_preferences"
51 remove_column "diary_entries", "language"
52 remove_column "diary_entries", "longitude"
53 remove_column "diary_entries", "latitude"