Sha256: e03b22c154e193e25a04642be05e359dc9665499299aab598992ce3783b31b4c

Contents?: true

Size: 1.87 KB

Versions: 5

Compression:

Stored size: 1.87 KB

Contents

class RenameColumnsForDevise < ActiveRecord::Migration
  def self.up
    return if column_exists?(:users, :password_salt)
    rename_column :users, :crypted_password, :encrypted_password
    rename_column :users, :salt, :password_salt
    rename_column :users, :remember_token_expires_at, :remember_created_at
    rename_column :users, :login_count, :sign_in_count
    rename_column :users, :failed_login_count, :failed_attempts
    rename_column :users, :single_access_token, :reset_password_token
    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_column :users, :authentication_token, :string
    add_column :users, :unlock_token, :string
    add_column :users, :locked_at, :datetime
    remove_column :users, :api_key
    remove_column :users, :openid_identifier
  end

  def self.down
    remove_column :users, :authentication_token
    remove_column :users, :locked_at
    remove_column :users, :unlock_token
    rename_column :table_name, :new_column_name, :column_name
    rename_column :users, :last_sign_in_ip, :last_login_ip
    rename_column :users, :current_sign_in_ip, :current_login_ip
    rename_column :users, :last_sign_in_at, :last_login_at
    rename_column :users, :current_sign_in_at, :current_login_at
    rename_column :users, :reset_password_token, :single_access_token
    rename_column :users, :failed_attempts, :failed_login_count
    rename_column :users, :sign_in_count, :login_count
    rename_column :users, :remember_created_at, :remember_token_expires_at
    rename_column :users, :password_salt, :salt
    rename_column :users, :encrypted_password, :crypted_password
    add_column :users, :unlock_token, :string
    add_column :users, :openid_identifier, :string
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree_auth-0.50.4 db/migrate/20101026184950_rename_columns_for_devise.rb
spree_auth-0.50.3 db/migrate/20101026184950_rename_columns_for_devise.rb
spree_auth-0.50.2 db/migrate/20101026184950_rename_columns_for_devise.rb
spree_auth-0.50.1 db/migrate/20101026184950_rename_columns_for_devise.rb
spree_auth-0.50.0 db/migrate/20101026184950_rename_columns_for_devise.rb