Mitchell R
|
936e6170a6
|
feat(store): Postgres adapter foundation + BF_DB selector (phase 1)
Lays groundwork for sqlite|postgres backend selection without yet
converting Repository. Adds:
- db-adapter.ts: async DbAdapter interface (run/get/all/exec/transaction)
- sqlite-adapter.ts: wraps node:sqlite sync API in Promise-returning shape,
caches prepared statements
- pg-adapter.ts: pg Pool + ? → $N placeholder rewrite + RETURNING-id
capture + savepoint-nested transactions
- service-store config: driver (sqlite|postgres), pgUrl
- BF_DB env override, plumbed via envStr
Selecting BF_DB=postgres throws at init() until the Repository is
converted off DatabaseSync. This commit ships the foundation only.
Next phases (separate commits):
2. Convert Repository methods sync → async via DbAdapter
3. Update every caller to await
4. Split MIGRATIONS into sqlite + portable / pg-specific sets
5. UUIDv7 IDs for new tables on PG path
Adds deps: pg ^8.13.1, uuidv7 ^1.0.2, @types/pg ^8.20.0
|
2026-05-18 22:50:48 +02:00 |
|