1 class CreateUsers < ActiveRecord::Migration
3 create_table :users do |t|
4 t.column "group_id", :integer, :limit => 10, :default => 4, :null => false
5 t.column "username", :string, :limit => 200, :default => "", :null => false
6 t.column "password", :string, :limit => 40, :default => "", :null => false
7 t.column "email", :string, :limit => 50, :default => "", :null => false
8 t.column "title", :string, :limit => 50
9 t.column "realname", :string, :limit => 40
10 t.column "url", :string, :limit => 100
11 t.column "jabber", :string, :limit => 75
12 t.column "icq", :string, :limit => 12
13 t.column "msn", :string, :limit => 50
14 t.column "aim", :string, :limit => 30
15 t.column "yahoo", :string, :limit => 30
16 t.column "location", :string, :limit => 30
17 t.column "use_avatar", :boolean, :default => false, :null => false
18 t.column "signature", :text
19 t.column "disp_topics", :integer, :limit => 3
20 t.column "disp_posts", :integer, :limit => 3
21 t.column "email_setting", :boolean, :default => true, :null => false
22 t.column "save_pass", :boolean, :default => true, :null => false
23 t.column "notify_with_post", :boolean, :default => false, :null => false
24 t.column "show_smilies", :boolean, :default => true, :null => false
25 t.column "show_img", :boolean, :default => true, :null => false
26 t.column "show_img_sig", :boolean, :default => true, :null => false
27 t.column "show_avatars", :boolean, :default => true, :null => false
28 t.column "show_sig", :boolean, :default => true, :null => false
29 t.column "timezone", :float, :default => 0.0, :null => false
30 t.column "language", :string, :limit => 25, :default => "English", :null => false
31 t.column "style", :string, :limit => 25, :default => "Oxygen", :null => false
32 t.column "num_posts", :integer, :limit => 10, :default => 0, :null => false
33 t.column "last_post", :integer, :limit => 10
34 t.column "created_at", :timestamp, :limit => 14, :null => false
35 t.column "registration_ip", :string, :limit => 15, :default => "0.0.0.0", :null => false
36 t.column "last_visit", :integer, :limit => 10, :default => 0, :null => false
37 t.column "admin_note", :string, :limit => 30
38 t.column "activate_string", :string, :limit => 50
39 t.column "activate_key", :string, :limit => 8
40 t.column "salt", :string, :limit => 40
42 add_index "users", ["created_at"], :name => "users_created_at_idx"
43 add_index "users", ["username"], :name => "users_username_idx"
45 say_with_time "Adding default users ..." do
46 path = "db/migrate/users.yaml"
47 records = YAML::load(File.open(File.expand_path(path, RAILS_ROOT)))
48 records.each do |record|
49 user = User.new(record[1])
50 # these fields are filtered out
51 user.username = record[1]["username"]
52 user.group_id = record[1]["group_id"]
53 user.passwd_confirmation = user.passwd
54 user.email_confirmation = user.email