Skip to content

Instantly share code, notes, and snippets.

@sumskyi
Created July 22, 2010 19:21
Show Gist options
  • Save sumskyi/486448 to your computer and use it in GitHub Desktop.
Save sumskyi/486448 to your computer and use it in GitHub Desktop.
Authlogic to Clearance migration
class ClearanceUpdateUsersTo088 < ActiveRecord::Migration
# TODO: fix mysql columns from UTF8 to ASCII
def self.up
rename_column :users, :crypted_password, :encrypted_password
change_column :users, :encrypted_password, :string, :limit => 128
rename_column :users, :password_salt, :salt
change_column :users, :salt, :string, :limit => 128
rename_column :users, :persistence_token, :remember_token
change_column :users, :remember_token, :string, :limit => 128
add_column :users, :confirmation_token, :string, :limit => 128
rename_column :users, :temp, :email_confirmed
change_column :users, :email_confirmed, :boolean, :default => false, :null => false
add_index :users, [:id, :confirmation_token], :name => 'index_users_on_id_and_confirmation_token'
add_index :users, :remember_token
end
def self.down
remove_index :users, :remember_token
remove_index :users, :name => 'index_users_on_id_and_confirmation_token'
change_column :users, :email_confirmed, :string, :default => false
rename_column :users, :email_confirmed, :temp
remove_column :users, :confirmation_token
change_column :users, :remember_token, :string, :limit => 255
rename_column :users, :remember_token, :persistence_token
change_column :users, :salt, :string, :limit => 255
rename_column :users, :salt, :password_salt
change_column :users, :encrypted_password, :string, :limit => 255
rename_column :users, :encrypted_password, :crypted_password
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment