Fix migration - scrypt

This commit is contained in:
Ari Timonen 2020-04-02 05:08:58 +03:00
parent 3569f52d4a
commit 7ec70323bf

View file

@ -2,10 +2,9 @@
ENV['SCRYPT_MAX_TIME'] ||= "0.03"
class UpdatePasswordsToScrypt < ActiveRecord::Migration[6.0]
require 'scrypt'
require 'user'
def up
SCrypt::Engine.calibrate!(max_time: ENV['SCRYPT_MAX_TIME'])
SCrypt::Engine.calibrate!(max_time: ENV['SCRYPT_MAX_TIME'].to_f)
ActiveRecord::Base.transaction do
User.all.order(:id).each do |user|
user.team = nil unless user&.team&.present?