36 lines
1.1 KiB
Ruby
36 lines
1.1 KiB
Ruby
|
class AddDeviseToUsers < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
change_table(:users) do |t|
|
||
|
## Recoverable
|
||
|
t.string :reset_password_token
|
||
|
t.datetime :reset_password_sent_at
|
||
|
|
||
|
## Rememberable
|
||
|
t.datetime :remember_created_at
|
||
|
|
||
|
## Trackable
|
||
|
t.integer :sign_in_count, :default => 0, :null => false
|
||
|
end
|
||
|
|
||
|
# remove authlogic stuff
|
||
|
remove_column :users, :persistence_token
|
||
|
remove_column :users, :perishable_token
|
||
|
|
||
|
# modify authlogic stuff
|
||
|
rename_column :users, :crypted_password, :encrypted_password
|
||
|
rename_column :users, :current_login_at, :current_sign_in_at
|
||
|
rename_column :users, :last_login_at, :last_sign_in_at
|
||
|
rename_column :users, :current_login_ip, :current_sign_in_ip
|
||
|
rename_column :users, :last_login_ip, :last_sign_in_ip
|
||
|
|
||
|
add_index :users, :reset_password_token, :unique => true
|
||
|
end
|
||
|
|
||
|
def self.down
|
||
|
# By default, we don't want to make any assumption about how to roll back a migration when your
|
||
|
# model already existed. Please edit below which fields you would like to remove in this migration.
|
||
|
raise ActiveRecord::IrreversibleMigration
|
||
|
end
|
||
|
end
|
||
|
|