20120728210244_devise_create_users.rb 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. class DeviseCreateUsers < ActiveRecord::Migration[4.2]
  2. def change
  3. create_table(:users) do |t|
  4. ## Database authenticatable
  5. t.string :email, :null => false, :default => ""
  6. t.string :encrypted_password, :null => false, :default => ""
  7. ## Recoverable
  8. t.string :reset_password_token
  9. t.datetime :reset_password_sent_at
  10. ## Rememberable
  11. t.datetime :remember_created_at
  12. ## Trackable
  13. t.integer :sign_in_count, :default => 0
  14. t.datetime :current_sign_in_at
  15. t.datetime :last_sign_in_at
  16. t.string :current_sign_in_ip
  17. t.string :last_sign_in_ip
  18. ## Confirmable
  19. # t.string :confirmation_token
  20. # t.datetime :confirmed_at
  21. # t.datetime :confirmation_sent_at
  22. # t.string :unconfirmed_email # Only if using reconfirmable
  23. ## Lockable
  24. # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
  25. # t.string :unlock_token # Only if unlock strategy is :email or :both
  26. # t.datetime :locked_at
  27. ## Token authenticatable
  28. # t.string :authentication_token
  29. t.timestamps
  30. end
  31. add_index :users, :email, :unique => true
  32. add_index :users, :reset_password_token, :unique => true
  33. # add_index :users, :confirmation_token, :unique => true
  34. # add_index :users, :unlock_token, :unique => true
  35. # add_index :users, :authentication_token, :unique => true
  36. end
  37. end