Juanma Perez
09/09/2022, 4:20 PMmodel Student {
id Int @id @default(autoincrement()
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
reviews Review[]
}
model Teacher {
id Int @id @default(autoincrement()
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
reviews Review[]
}
model Review {
id Int @id @default(autoincrement()
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
text String
profile Student or Teacher? @relation(fields: [profileId], references: [id])
profileId Int
}
R2D2
09/09/2022, 9:19 PMProfie {
id Int @id @default(autoincrement()
teacherId Int?
studientId Int?
}
or one classical way to extend review table with all posible joins
Review {
...
teacherId Int?
studentId Int?
}
David Hancu
09/10/2022, 8:38 AMR2D2
09/10/2022, 8:06 PMJuanma Perez
09/11/2022, 12:45 PM