• Download Gist
convert_users_tokens_to_always_remember_me_clearance.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
class ConvertUsersTokensToAlwaysRememberMeClearance < ActiveRecord::Migration
def self.up
remove_index :users, :column => :token
remove_index :users, :column => [:id, :token]
 
remove_column :users, :token
remove_column :users, :token_expires_at
 
add_column :users, :confirmation_token, :string, :limit => 128
add_column :users, :remember_token, :string, :limit => 128
 
add_index :users, [:id, :confirmation_token]
add_index :users, :remember_token
end
 
def self.down
remove_index :users, :column => :remember_token
remove_index :users, :column => [:id, :confirmation_token]
 
remove_column :users, :remember_token
remove_column :users, :confirmation_token
 
add_column :users, :token_expires_at, :datetime
add_column :users, :token, :string, :limit => 128
 
add_index :users, :token
add_index :users, [:id, :token]
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.