In Magento 2, From Magento Version 2.3 and higher version contains the declarative schema approach for InstallSchema/Upgrade schema, InstallData/Upgrade data functionality.
You can create db_schema_whitelist.json using Command line with a single command,
Generated file location is the <Vendorname>/<Modulename>/etc/db_schema_whitelist.json in your module.
This file provides a history of modules all tables, columns, and keys added with a declarative schema.
You need to run below command to generate a file,
php bin/magento setup:db-declaration:generate-whitelist [options]
Where [options] will be,
–module-name[=Modulename] specifies the Module name to generate a whitelist.
If Modulename is not specified, then the default behavior is to generate a whitelist for all the modules in a system. You can set options as –module-name=all for all the module.
If your module name is,
Vendor_Packagename and you want to generate a db_schema_whitelist.json file,
Run the command,
php bin/magento setup:db-declaration:generate-whitelist –module-name=Vendor_Packagename (two times – before module-name)
You can see your db_schema_whitelist.json file in your modules etc folder.