ensl.org/db/migrate/20200401031518_update_passwords_to_scrypt.rb

15 lines
308 B
Ruby
Raw Normal View History

2020-04-02 00:08:19 +00:00
class UpdatePasswordsToScrypt < ActiveRecord::Migration[6.0]
require 'scrypt'
require 'user'
def up
SCrypt::Engine.calibrate!(max_time: 0.03)
ActiveRecord::Base.transaction do
User.all.order(:id).each do |user|
user.update_password
user.save!
end
end
end
end