An unofficial, mostly Bitwarden-compatible API server written in Ruby (Sinatra and ActiveRecord)
1class NoNullKdfIterations < ActiveRecord::Migration[5.1]
2 def change
3 User.all.each do |u|
4 # any old users without a kdf_iterations value probably have the old
5 # value of 5000
6 if !u.kdf_iterations
7 u.kdf_iterations = 5000
8 u.kdf_type = Bitwarden::KDF::PBKDF2
9 end
10 u.save!
11 end
12
13 # but going forward, any new users should get whatever defaults are set in
14 # the future
15 change_column :users, :kdf_iterations, :integer, :null => false,
16 :default => Bitwarden::KDF::DEFAULT_ITERATIONS[User::DEFAULT_KDF_TYPE]
17 end
18end