Skip to content

Commit

Permalink
fix(sql): Fix QueryResult typings (#1928)
Browse files Browse the repository at this point in the history
* fix(sql): Fix QueryResult typings

closes #1893

* Create fix-sql-queryresult-type.md

---------

Co-authored-by: Tillmann <[email protected]>
  • Loading branch information
FabianLars and tweidinger authored Dec 2, 2024
1 parent 6f6a178 commit 3195646
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-sql-queryresult-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sql-js: patch
---

Fixed the QueryResult typing by marking `lastInsertId` as optional to reflect postgres-only changes made in the 2.0.0 release.
4 changes: 2 additions & 2 deletions plugins/sql/guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export interface QueryResult {
/**
* The last inserted `id`.
*
* This value is always `0` when using the Postgres driver. If the
* This value is not set for Postgres databases. If the
* last inserted id is required on Postgres, the `select` function
* must be used, with a `RETURNING` clause
* (`INSERT INTO todos (title) VALUES ($1) RETURNING id`).
*/
lastInsertId: number
lastInsertId?: number
}

/**
Expand Down

0 comments on commit 3195646

Please sign in to comment.