prisma id required?

why is it not typed as optional?
model ProductCategory {
categoryId String @id @default(uuid())
categoryName String
products Product[] @ignore
}
model ProductCategory {
categoryId String @id @default(uuid())
categoryName String
products Product[] @ignore
}
No description
3 Replies
dan
dan7mo ago
The primary key (@id) cannot be null therefor must have a value
K1|ller
K1|ller7mo ago
ok I solved the issue, it is the zod schema type which has the uuid not market as optional i'm generating the zod schemas with a package this solved the issue: createOptionalDefaultValuesTypes = true the problem is that, the schema has a long name looks nasty
K1|ller
K1|ller7mo ago
No description