Hello Magento friends todays im share with you to How to Rename a database tablename using db_schema in Magento 2
Using the db schema.xml file, you can add new tables in Magento 2. If you want to change a table's name in magento2 after it has been created, you can do so by utilising declarative schema.
➤ To create the db schema whitelist.json file, you must now run the generate-whitelist command.
command : php bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
➤ Where Vendor_Name_Package_Name is your Vendor and Package_Name.
➤ After that , you can change the table name using below tag in the XML file in magento2:
➤ where rename_tablename is your new table name and mycustom_table is your old table name in the above tag.
The new db_schema.xml file will be,
➤ After Add Code in db_schema.xml file, you need to run this bellow command :
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush