aboutsummaryrefslogtreecommitdiffstats
path: root/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb
blob: 4197125c34b86996a97a237acacd2aa206190d2c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class RemovePasswordSaltFromUsers < ActiveRecord::Migration
  def self.up
    remove_column ::Refinery::User.table_name, :password_salt
    # Make the current password invalid :(
    ::Refinery::User.all.each do |u|
      u.update_attribute(:encrypted_password, u.encrypted_password[29..-1])
    end

    ::Refinery::User.reset_column_information
  end

  def self.down
    add_column ::Refinery::User.table_name, :password_salt, :string

    ::Refinery::User.reset_column_information
  end
end