# frozen-string-literal: true module Rodauth def self.create_database_authentication_functions(db, opts={}) table_name = opts[:table_name] || :account_password_hashes get_salt_name = opts[:get_salt_name] || :rodauth_get_salt valid_hash_name = opts[:valid_hash_name] || :rodauth_valid_password_hash case db.database_type when :postgres db.run <:account_previous_password_hashes, :get_salt_name=>:rodauth_get_previous_salt, :valid_hash_name=>:rodauth_previous_password_hash_match) end def self.drop_database_previous_password_check_functions(db) case db.database_type when :postgres db.run "DROP FUNCTION rodauth_get_previous_salt(int8)" db.run "DROP FUNCTION rodauth_previous_password_hash_match(int8, text)" when :mysql, :mssql db.run "DROP FUNCTION rodauth_get_previous_salt" db.run "DROP FUNCTION rodauth_previous_password_hash_match" end end end