You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
likethesky edited this page Jun 18, 2012
·
8 revisions
Devise 2.0 no longer includes helpers for your migrations (even for your old migrations creating tables used in versions prior to 2.0). Instead, we simply list the database fields explicitly. This page shows the before and after of your original Devise migration(s) so you can easily compare and update your code.
Meaning: You will need to change your original Devise migration(s) to not use the Before helpers, but instead use the fields listed in After, here. Be sure to check all of your migrations, not just your initial migration creating your User table (for instance), for those migrations where you might have added additional Devise features and previously used the helpers.
Active Record
Below follows the generated code before and after Devise 2.0. You can use it as guideline but also consult your schema.rb for extra help.
create_table(TABLE_NAME)do |t|
## Database authenticatablet.string:email,:null=>false,:default=>""t.string:encrypted_password,:null=>false,:default=>""## Recoverablet.string:reset_password_tokent.datetime:reset_password_sent_at## Rememberablet.datetime:remember_created_at## Trackablet.integer:sign_in_count,:default=>0t.datetime:current_sign_in_att.datetime:last_sign_in_att.string:current_sign_in_ipt.string:last_sign_in_ip## Encryptable# t.string :password_salt## Confirmable# t.string :confirmation_token# t.datetime :confirmed_at# t.datetime :confirmation_sent_at# t.string :unconfirmed_email # Only if using reconfirmable## Lockable# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts# t.string :unlock_token # Only if unlock strategy is :email or :both# t.datetime :locked_at# Token authenticatable# t.string :authentication_token## Invitable# t.string :invitation_tokent.timestampsend
Mongoid
Before Devise 2.0, Devise automatically configured your MongoDB. This is no longer true. In order to upgrade, you need to set Devise.apply_schema to false and add the following to your model according to the strategies you are using:
## Database authenticatablefield:email,:type=>String,:null=>falsefield:encrypted_password,:type=>String,:null=>false## Recoverablefield:reset_password_token,:type=>Stringfield:reset_password_sent_at,:type=>Time## Rememberablefield:remember_created_at,:type=>Time## Trackablefield:sign_in_count,:type=>Integerfield:current_sign_in_at,:type=>Timefield:last_sign_in_at,:type=>Timefield:current_sign_in_ip,:type=>Stringfield:last_sign_in_ip,:type=>String## Encryptable# field :password_salt, :type => String## Confirmable# field :confirmation_token, :type => String# field :confirmed_at, :type => Time# field :confirmation_sent_at, :type => Time# field :unconfirmed_email, :type => String # Only if using reconfirmable## Lockable# field :failed_attempts, :type => Integer # Only if lock strategy is :failed_attempts# field :unlock_token, :type => String # Only if unlock strategy is :email or :both# field :locked_at, :type => Time# Token authenticatable# field :authentication_token, :type => String## Invitable# field :invitation_token, :type => String