Summary
getOrCreateBunSql only rebuilds when dialect or database.database changes. Changing host, port, username, password, url, or pool via setConfig does not invalidate the cached connection, and setConfig never calls resetConnection. Callers must know to call resetConnection() manually — undocumented at the setConfig boundary.
Location
src/db.ts:~469-483; setConfig in src/config.ts:~160.
Suggested fix
Key the cache on the full resolved connection string + pool options, or have setConfig call resetConnection() when any database.* field changes.
Severity: medium. Found via internal code audit.