refactor(db): move the Kysely dialect helpers into kysely-functions.ts

sql-functions.ts sat at 1007 lines, held there by the size baseline, so it
had no room for the Postgres branch every helper is meant to grow. The
Kysely-expression twins are a separate family already (a Kysely Expression
and a MikroORM RawQueryFragment do not convert into each other), so they
move to src/db/dialect/kysely-functions.ts, and the platform check plus the
fail-closed unsupported() move to platform.ts, which both files share.

No helper changes behaviour or spelling. lint:dialect now skips the whole
src/db/dialect/ directory instead of the one file, and the size baseline
drops its sql-functions.ts entry.
This commit is contained in:
Maurice
2026-10-08 16:16:19 +02:00
parent 1d6719347b
commit 53d9ec5678
17 changed files with 319 additions and 287 deletions
@@ -11,7 +11,6 @@ import {
caseWhenEquals,
caseWhenNotNull,
castInteger,
castIntegerKysely,
coalesce,
coalesceOverride,
coalesceOverrideWhileSame,
@@ -20,11 +19,9 @@ import {
columnIncrementedBy,
columnRef,
concat,
concatKysely,
countAll,
countAllRef,
currentTimestamp,
currentTimestampKysely,
dateAdd,
dateOf,
dayDistance,
@@ -39,14 +36,19 @@ import {
nowMinusDays,
nowMinusHours,
nowPlusSeconds,
nowPlusSecondsKysely,
startsWithIsoDate,
startsWithIsoDateKysely,
substring,
substringKysely,
trim,
unixEpochToIsoKysely,
} from '../../../../src/db/dialect/sql-functions';
import {
castIntegerKysely,
concatKysely,
currentTimestampKysely,
nowPlusSecondsKysely,
startsWithIsoDateKysely,
substringKysely,
unixEpochToIsoKysely,
} from '../../../../src/db/dialect/kysely-functions';
import { createJourney, createJourneyEntry } from '../../../helpers/factories';
/** The `users` columns the Kysely-expression tests below read/write, narrowed the same way every other Kysely-typed repository method in this program declares its own `TDB`. */