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_pk, :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_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.find(:all, :conditions => "token is not null").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", :double
43 add_column "users", "within_lon", :double
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"