20120710220825_devise_create_admin_users.rb 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class DeviseCreateAdminUsers < ActiveRecord::Migration
  2. def change
  3. create_table(:admin_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. # Create a default user
  32. #AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')
  33. AdminUser.create!(:email => 'paul@netdome.biz', :password => 'password', :password_confirmation => 'password')
  34. add_index :admin_users, :email, :unique => true
  35. add_index :admin_users, :reset_password_token, :unique => true
  36. # add_index :admin_users, :confirmation_token, :unique => true
  37. # add_index :admin_users, :unlock_token, :unique => true
  38. # add_index :admin_users, :authentication_token, :unique => true
  39. end
  40. end