1 class UserEnhancements < ActiveRecord::Migration
3 add_column "diary_entries", "latitude", :double
4 add_column "diary_entries", "longitude", :double
5 add_column "diary_entries", "language", :string, :limit => 3
7 create_table "user_preferences", innodb_table do |t|
8 t.column "user_id", :bigint, :limit => 20, :null => false
9 t.column "k", :string, :null => false
10 t.column "v", :string, :null => false
13 add_primary_key "user_preferences", ["user_id", "k"]
15 create_table "user_tokens", innodb_table do |t|
16 t.column "id", :bigint, :limit => 20, :null => false
17 t.column "user_id", :bigint, :limit => 20, :null => false
18 t.column "token", :string, :null => false
19 t.column "expiry", :datetime, :null => false
22 add_primary_key "user_tokens", ["id"]
23 add_index "user_tokens", ["token"], :name => "user_tokens_token_idx", :unique => true
24 add_index "user_tokens", ["user_id"], :name => "user_tokens_user_id_idx"
26 change_column "user_tokens", "id", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT"
28 User.find(:all, :conditions => "token is not null").each do |user|
29 UserToken.create(:user_id => user.id, :token => user.token, :expiry => 1.week.from_now)
32 remove_column "users", "token"
33 remove_column "users", "timeout"
34 remove_column "users", "within_lon"
35 remove_column "users", "within_lat"
36 add_column "users", "nearby", :integer, :default => 50
37 add_column "users", "pass_salt", :string
39 User.update_all("nearby = 50");
43 remove_column "users", "pass_salt"
44 remove_column "users", "nearby"
45 add_column "users", "within_lat", :double
46 add_column "users", "within_lon", :double
47 add_column "users", "timeout", :datetime
48 add_column "users", "token", :string
50 drop_table "user_tokens"
52 drop_table "user_preferences"
54 remove_column "diary_entries", "language"
55 remove_column "diary_entries", "longitude"
56 remove_column "diary_entries", "latitude"