2012-04-18 13:46:09 +01:00
|
|
|
class AddTokenAuthenticatableToUsers < ActiveRecord::Migration
|
2012-04-19 11:50:43 +01:00
|
|
|
def self.up
|
|
|
|
add_column :users, :authentication_token, :string
|
2012-04-18 16:15:04 +01:00
|
|
|
add_index :users, :authentication_token
|
|
|
|
|
2012-04-18 13:46:09 +01:00
|
|
|
User.all.each do |user|
|
|
|
|
user.ensure_authentication_token!
|
|
|
|
end
|
|
|
|
end
|
2012-04-19 11:50:43 +01:00
|
|
|
|
|
|
|
def self.down
|
|
|
|
remove_column :users, :authentication_token
|
|
|
|
end
|
2012-04-18 13:46:09 +01:00
|
|
|
end
|