fix: address review findings on postgres backend

- PostgresMigrator: run JS migration parts on the transactional client
  (WrappedPgTx) instead of the pool, preserving migration atomicity
- pool.ts: guard ROLLBACK so a failing rollback no longer masks the
  original error (also applied in the migrator loop)
- pool.ts: share all/get/run between WrappedPool and WrappedPgTx via a
  common base class
- sql.ts: document that toPositional precludes JSONB ?/?|/?& operators
- PostgresInterface: implement deleteSession, required by
  BackendDbInterface since the logout-invalidation change on master

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit was merged in pull request #1.
This commit is contained in:
2026-07-20 02:03:47 +00:00
co-authored by Claude
parent 4521274a27
commit b9fa79ff1f
4 changed files with 57 additions and 42 deletions
+8
View File
@@ -408,6 +408,14 @@ export class PostgresInterface implements BackendDbInterface {
`);
}
async deleteSession(token: `as_${string}`): Promise<void> {
this.#checkReadonly();
await this.#db.run(sql`
DELETE FROM "sessions"
WHERE "token" = ${{ text: token }}
`);
}
async #getApikeyByToken(
token: `at_${string}`,
db: WrappedPgClient