3 class UserEnhancements < ActiveRecord::Migration
5 add_column "diary_entries", "latitude", :double
6 add_column "diary_entries", "longitude", :double
7 add_column "diary_entries", "language", :string, :limit => 3
9 create_table "user_preferences", innodb_table do |t|
10 t.column "user_id", :bigint, :limit => 20, :null => false
11 t.column "k", :string, :null => false
12 t.column "v", :string, :null => false
15 add_primary_key "user_preferences", ["user_id", "k"]
17 create_table "user_tokens", innodb_table do |t|
18 t.column "id", :bigint_pk, :null => false
19 t.column "user_id", :bigint, :limit => 20, :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.find(:all, :conditions => "token is not null").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", :double
45 add_column "users", "within_lon", :double
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"