File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed
content/200-orm/100-prisma-schema Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff 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
6666enum 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
Original file line number Diff line number Diff 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
426426model 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments