global

def add_previous_password_hash(hash)

def add_previous_password_hash(hash) 
  ds = previous_password_ds
  keep_before = ds.reverse(previous_password_id_column).
    limit(nil, previous_passwords_to_check).
    get(previous_password_id_column)
  ds.where(Sequel.expr(previous_password_id_column) <= keep_before).
    delete
  # This should never raise uniqueness violations, as it uses a serial primary key
  ds.insert(previous_password_account_id_column=>account_id, previous_password_hash_column=>hash)
end