20160305115639_add_devise_to_users.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. class AddDeviseToUsers < ActiveRecord::Migration[4.2]
  2. def self.up
  3. change_table(:users) do |t|
  4. ## Database authenticatable
  5. t.string :encrypted_password, null: false, default: ""
  6. ## Recoverable
  7. t.string :reset_password_token
  8. t.datetime :reset_password_sent_at
  9. ## Rememberable
  10. t.datetime :remember_created_at
  11. ## Trackable
  12. t.integer :sign_in_count, default: 0, null: false
  13. t.datetime :current_sign_in_at
  14. t.datetime :last_sign_in_at
  15. t.inet :current_sign_in_ip
  16. t.inet :last_sign_in_ip
  17. end
  18. add_index :users, :reset_password_token, unique: true
  19. end
  20. def self.down
  21. remove_index :users, :reset_password_token
  22. remove_column :users, :encrypted_password
  23. remove_column :users, :reset_password_token
  24. remove_column :users, :reset_password_sent_at
  25. remove_column :users, :remember_created_at
  26. remove_column :users, :sign_in_count
  27. remove_column :users, :current_sign_in_at
  28. remove_column :users, :current_sign_in_ip
  29. remove_column :users, :last_sign_in_at
  30. remove_column :users, :last_sign_in_ip
  31. end
  32. end