From 287de9b14027ef947a1debd1f86a4ce3916b0e34 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Sun, 13 Oct 2024 17:19:07 +0200 Subject: [PATCH 1/2] fix(sql): Fix QueryResult typings closes #1893 --- plugins/sql/guest-js/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/sql/guest-js/index.ts b/plugins/sql/guest-js/index.ts index 05eed0e3ae..74f6dc7bab 100644 --- a/plugins/sql/guest-js/index.ts +++ b/plugins/sql/guest-js/index.ts @@ -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 } /** From 591a30b40dc32d69b168b59122036d870410a70d Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Sun, 13 Oct 2024 17:20:46 +0200 Subject: [PATCH 2/2] Create fix-sql-queryresult-type.md --- .changes/fix-sql-queryresult-type.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/fix-sql-queryresult-type.md diff --git a/.changes/fix-sql-queryresult-type.md b/.changes/fix-sql-queryresult-type.md new file mode 100644 index 0000000000..f93f741c6e --- /dev/null +++ b/.changes/fix-sql-queryresult-type.md @@ -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.