fix(db): disable sqlx check_compatibility for non-standard PostgreSQL servers

Cloud-managed PostgreSQL variants (PolarDB, CockroachDB, etc.) may
not return a standard version string, causing:
  "Failed to obtain server version. Unable to check client-server
   compatibility."

Setting check_compatibility(false) on both writer and reader
connections silences this harmless warning.
This commit is contained in:
ZhenYi 2026-04-26 15:36:13 +08:00
parent 638dfd7a6e
commit 31ed420186

View File

@ -31,6 +31,7 @@ impl AppDatabase {
.connect_timeout(Duration::from_secs(connection_timeout))
.set_schema_search_path(schema_search_path)
.sqlx_logging(false)
.check_compatibility(false)
.to_owned();
let db_write = Database::connect(conn_cfg).await?;
@ -42,6 +43,7 @@ impl AppDatabase {
.idle_timeout(Duration::from_secs(idle_timeout))
.max_lifetime(Duration::from_secs(max_lifetime))
.connect_timeout(Duration::from_secs(connection_timeout))
.check_compatibility(false)
.to_owned();
Some(Database::connect(conn_cfg).await?)