Skip to content

Commit 41c5cd7

Browse files
authored
Make authorEmail unique in Post model
Add the @unique attribute to the authorEmail field in the example to show reference of a non-ID field
1 parent 1f185d8 commit 41c5cd7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/docs/content/docs/orm/prisma-schema/data-model/relations/one-to-many-relations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ You can also reference a non-ID field with `@unique`:
3131
```prisma
3232
model Post {
3333
id Int @id @default(autoincrement())
34-
authorEmail String
34+
authorEmail String @unique
3535
author User @relation(fields: [authorEmail], references: [email])
3636
}
3737
```

0 commit comments

Comments
 (0)