Skip to content

Commit

Permalink
docs: document primaryKey option on uuid type (knex#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare committed Jun 8, 2022
1 parent cafb030 commit 1fee59a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/guide/schema-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1fee59a

Please sign in to comment.