OSDN Git Service

v07
[pettanr/pettanr.git] / db / migrate / 20111206092734_devise_create_admins.rb
1 class DeviseCreateAdmins < ActiveRecord::Migration
2   def change
3     create_table(:admins) do |t|
4       ## Database authenticatable
5       t.string :email,              :null => false, :default => ""
6       t.string :encrypted_password, :null => false, :default => ""
7
8       ## Recoverable
9       t.string   :reset_password_token
10       t.datetime :reset_password_sent_at
11
12       ## Rememberable
13       t.datetime :remember_created_at
14
15       ## Trackable
16       t.integer  :sign_in_count, :default => 0
17       t.datetime :current_sign_in_at
18       t.datetime :last_sign_in_at
19       t.string   :current_sign_in_ip
20       t.string   :last_sign_in_ip
21
22       # t.encryptable
23       ## Confirmable
24       t.string   :confirmation_token
25       t.datetime :confirmed_at
26       t.datetime :confirmation_sent_at
27       t.string   :unconfirmed_email # Only if using reconfirmable
28
29       ## Lockable
30       # t.integer  :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
31       # t.string   :unlock_token # Only if unlock strategy is :email or :both
32       # t.datetime :locked_at
33
34       # Token authenticatable
35       t.string :authentication_token
36
37       t.integer :approve, :null => false, :default => 0
38
39       t.timestamps
40     end
41
42     add_index :admins, :email,                :unique => true
43     add_index :admins, :reset_password_token, :unique => true
44     add_index :admins, :confirmation_token,   :unique => true
45     # add_index :admins, :unlock_token,         :unique => true
46     add_index :admins, :authentication_token, :unique => true
47   end
48
49 end