refactor(db): keep the SQLite-only helpers and the Postgres number parsers explicit

createStandaloneOrm builds the SQLite schema snapshot, so it now refuses a
config that names another driver instead of silently building a snapshot of
the wrong engine. runSchemaBootstrap takes its snapshot flag as a required
argument: the reopen after a restore is the only caller that skips the copy,
and an omitted flag should not be able to pick a default for it.

The Postgres driver's number parsers say which values they refuse: NaN and
the infinities are reported as not finite instead of as beyond 2^53, which
was the wrong reason. The driver's header comment is folded into the constant
docs it described.
This commit is contained in:
Isaias Tavares
2026-11-05 00:56:25 -03:00
parent b8c9184dff
commit 1c3dc93716
7 changed files with 42 additions and 29 deletions
@@ -23,7 +23,8 @@ describe('postgres driver', () => {
expect(parseNumeric('2.5000000000000000')).toBe(2.5);
expect(parseNumeric('-7')).toBe(-7);
expect(() => parseNumeric('9007199254740993')).toThrow(/beyond what TREK reads exactly/);
expect(() => parseNumeric('NaN')).toThrow(/beyond what TREK reads exactly/);
expect(() => parseNumeric('NaN')).toThrow(/not a finite number/);
expect(() => parseNumeric('Infinity')).toThrow(/not a finite number/);
});
it("PGDRIVER-002: the pool parses int8 as a number and keeps MikroORM's text dates", () => {