From fef3525119a6e4750a2f9353fb95240ef14ce97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Koskim=C3=A4ki?= Date: Sat, 9 Sep 2023 11:14:20 +0300 Subject: [PATCH] improve basic insert site example --- src/query-builder/insert-query-builder.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/query-builder/insert-query-builder.ts b/src/query-builder/insert-query-builder.ts index 2190d0b96..bbfac24a5 100644 --- a/src/query-builder/insert-query-builder.ts +++ b/src/query-builder/insert-query-builder.ts @@ -111,13 +111,18 @@ export class InsertQueryBuilder * }) * .executeTakeFirst() * + * // The `insertId` is only available on dialects that automatically + * // return the id of the inserted row such as MySQL and SQLite. + * // On postgres, for example, you need to add a `returning` clause + * // to the query to get anything out. See the "returning data" + * // example. * console.log(result.insertId) * ``` * - * The generated SQL (PostgreSQL): + * The generated SQL (MySQL): * * ```sql - * insert into "person" ("first_name", "last_name", "age") values ($1, $2, $3) + * insert into `person` (`first_name`, `last_name`, `age`) values (?, ?, ?) * ``` * *