Edit database connection details using API

Hello,
I'm interested in utilizing the API to modify the database and switch the environment. Could you guide me on the steps to achieve this using the API?

When attempting to delete a database, I encounter a message prompting me to update connection details. However, there's no provided link or procedure for this. Specifically, I need to edit the host, username, and password.

image

After updating the credentials, should I execute "Sync database schema now" and "Re-scan field values now"?

It appears that the API lacks arguments for updating the host, username, and password. How can I address this issue?

Additionally, my models are cached. How does this caching mechanism will work once migrated?