Skip to content

Commit 39e0dbd

Browse files
fix(prisma-schema): improve documentation readability (#7363)
* fix(overview): author & authorId cannot be optional * fix(data-model): post & postId cannot be optional * fix(indexes): update inline comment placements --------- Co-authored-by: Aman Varshney <[email protected]>
1 parent d72204e commit 39e0dbd

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

content/200-orm/100-prisma-schema/10-overview/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ model Post {
5959
updatedAt DateTime @updatedAt
6060
published Boolean @default(false)
6161
title String @db.VarChar(255)
62-
author User? @relation(fields: [authorId], references: [id])
63-
authorId Int?
62+
author User @relation(fields: [authorId], references: [id])
63+
authorId Int
6464
}
6565
6666
enum Role {
@@ -97,7 +97,7 @@ model Post {
9797
updatedAt DateTime @updatedAt
9898
published Boolean @default(false)
9999
title String
100-
author User? @relation(fields: [authorId], references: [id])
100+
author User @relation(fields: [authorId], references: [id])
101101
authorId String @db.ObjectId
102102
}
103103

content/200-orm/100-prisma-schema/20-data-model/10-models.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ model Comment {
407407
id Int
408408
// Other fields
409409
//highlight-next-line
410-
post Post? @relation(fields: [postId], references: [id]) // A comment can have one post
411-
postId Int?
410+
post Post @relation(fields: [postId], references: [id]) // A comment can have one post
411+
postId Int
412412
}
413413
```
414414

@@ -424,11 +424,11 @@ model Post {
424424
}
425425
426426
model Comment {
427-
id String @id @default(auto()) @map("_id") @db.Objectid
427+
id String @id @default(auto()) @map("_id") @db.Objectid
428428
// Other fields
429429
//highlight-next-line
430-
post Post? @relation(fields: [postId], references: [id]) // A comment can have one post
431-
postId String? @db.ObjectId
430+
post Post @relation(fields: [postId], references: [id]) // A comment can have one post
431+
postId String @db.ObjectId
432432
}
433433
```
434434

content/200-orm/100-prisma-schema/20-data-model/30-indexes.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ model Example {
206206
id Int @id
207207
value Json
208208
// ^ field type matching the operator class
209-
// ^ operator class ^ index type
210209
211210
@@index([value(ops: JsonbPathOps)], type: Gin)
211+
// ^ operator class ^ index type
212212
}
213213
```
214214

@@ -344,9 +344,9 @@ model Example {
344344
id Int @id
345345
value Int
346346
// ^ field type matching the operator class
347-
// ^ operator class ^ index type
348347
349348
@@index([value(ops: Int4BloomOps)], type: Brin)
349+
// ^ operator class ^ index type
350350
}
351351
```
352352

0 commit comments

Comments
 (0)