iamclaytonray
01/31/2021, 2:16 PMid
column and the expression for uuid is not there. Any advice/direction would be appreciatediamclaytonray
01/31/2021, 2:24 PMnikolasburk
@default(uuid())
in your Prisma schema, the UUID values are indeed generated by the Prisma query engine and not the DB. It's not yet possible to map this behaviour from Postgres to the Prisma schema in another way.
I think this is a design flaw of Prisma. IMO, Prisma should take advantaged of Postgres’s native ability to generate UUIDs.I think we actually agree with you here and want to fix this. Do you mind creating a GitHub issue so this can be tracked properly? 🙂
nikolasburk
Alberto Perdomo
nativeTypes
feature (in Preview) and dbgenerated(String)
.
Example:
model User {
id String @id @db.Uuid @default(dbgenerated("gen_random_uuid()"))
name String?
}
Release notes: https://github.com/prisma/prisma/releases/tag/2.16.0iamclaytonray
02/03/2021, 4:46 PM