mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 05:12:29 +00:00
Fixed logic where PGURL="mysql://" would incorrectly return mysql adapter instead of postgres. Environment variable names now take semantic precedence over URL protocols: - MYSQL_URL=postgres://host → mysql adapter (name wins) - PGURL=mysql://host → postgres adapter (name wins) - DATABASE_URL=mysql://host → mysql adapter (protocol detection as fallback) This is more intuitive and matches user expectations - if you set PGURL, you clearly intend PostgreSQL regardless of what protocol might be in the URL value. Simplified logic: 1. Explicit adapter (highest priority) 2. Environment variable name (semantic intent) 3. Protocol detection (fallback for DATABASE_URL only) 4. Default to postgres Added comprehensive tests to verify environment variable names override protocols in all scenarios. All 236 existing tests continue to pass. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>