mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 21:46:49 +00:00
4fa2f3dc8b
The dialect layer promised that a second engine would be a branch in src/db/dialect/ and no sweep through the repositories, but every helper only knew SQLite and threw for anything else. Each one now has a Postgres branch, and the helpers whose text both engines read alike (COALESCE, LOWER, TRIM, substr, ||, the aggregates, the CASE shapes) share one spelling behind isKnownPlatform. The Postgres branches keep the storage model SQLite has: the clock helpers render UTC as the same YYYY-MM-DD HH:MM:SS text (to_char over CURRENT_TIMESTAMP AT TIME ZONE 'UTC'), GLOB becomes an anchored regular expression, the integer cast truncates through numeric so '14.0' still reads as 14, JULIANDAY distance comes from the epoch difference, SQLite's null-safe IS becomes IS NOT DISTINCT FROM, and NOCASE names a nondeterministic ICU collation a Postgres schema creates. Bound values on the Kysely side are cast to text where pg would otherwise send an untyped parameter the planner cannot resolve. The SQLite branches are untouched, so nothing changes for a running install. The Postgres text is pinned in sql-functions.postgres.test.ts.