From 1fee59ae1cb0883cfbdf38606ab55795c66e42dc Mon Sep 17 00:00:00 2001 From: Lucas Bickel <116588+hairmare@users.noreply.github.com> Date: Wed, 8 Jun 2022 11:27:02 +0200 Subject: [PATCH] docs: document primaryKey option on uuid type (#419) --- src/guide/schema-builder.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/guide/schema-builder.md b/src/guide/schema-builder.md index 81d561d1ce..af6db13e45 100644 --- a/src/guide/schema-builder.md +++ b/src/guide/schema-builder.md @@ -590,9 +590,11 @@ Adds a jsonb column. Works similar to table.json(), but uses native jsonb type i ### uuid -**table.uuid(name, options=({[useBinaryUuid:boolean]})** +**table.uuid(name, options=({[useBinaryUuid:boolean],[primaryKey:boolean]})** -Adds a uuid column - this uses the built-in uuid type in PostgreSQL, and falling back to a char(36) in other databases by default. If useBinaryUuid is true, binary(16) is used. See uuidToBin function to convert uuid in binary before inserting and binToUuid to convert binary uuid to uuid. +Adds a uuid column - this uses the built-in uuid type in PostgreSQL, and falling back to a char(36) in other databases by default. +If useBinaryUuid is true, binary(16) is used. See uuidToBin function to convert uuid in binary before inserting and binToUuid to convert binary uuid to uuid. +If primaryKey is true, then for PostgreSQL the field will be configured as `uuid primary key`, for CockroackDB an additional `default gen_random_uuid()` is set on the type. ### geometry