Sha256: 39833f8cae799b2eba72ebe867d64f7988a3efe42438d9877bac4186d474ec0a

Contents?: true

Size: 544 Bytes

Versions: 10

Compression:

Stored size: 544 Bytes

Contents

Sequel.migration do
  up do
    scheme = Spontaneous::Crypt::Version::SHALegacy

    dataset = self[:spontaneous_users]

    dataset.each do |user|
      hash = scheme.create(user[:crypted_password], user[:salt])
      dataset.filter(:id => user[:id]).update(:crypted_password => hash)
    end

    drop_column :spontaneous_users, :salt
  end

  down do
    # There's no way to recover from the conversion -- the
    # hashed password is lost so all we can do is re-add the salt
    # column
    add_column :spontaneous_users, :salt
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta9 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta8 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta7 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta6 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta5 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta4 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta3 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta2 db/migrations/20130111161934_convert_bcrypt_passwords.rb
spontaneous-0.2.0.beta1 db/migrations/20130111161934_convert_bcrypt_passwords.rb