refactor: Update Prisma schema to include createdAt field in User and RoomMessage models
This commit is contained in:
parent
3301b365f9
commit
b07b6082e4
@ -8,13 +8,15 @@ datasource db {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
username String?
|
||||
role Role @default(STUDENT)
|
||||
id String @id @default(cuid())
|
||||
username String?
|
||||
role Role @default(STUDENT)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
Class Class[]
|
||||
SentMessages UserMessage[] @relation("SentMessages")
|
||||
ReceivedMessages UserMessage[] @relation("ReceivedMessages")
|
||||
Class Class[]
|
||||
SentMessages UserMessage[] @relation("SentMessages")
|
||||
ReceivedMessages UserMessage[] @relation("ReceivedMessages")
|
||||
RoomSurveyAnswerUser RoomSurveyAnswerUser[]
|
||||
}
|
||||
|
||||
model UserMessage {
|
||||
@ -26,22 +28,26 @@ model UserMessage {
|
||||
|
||||
receiver User @relation(fields: [receiver_user_Id], references: [id], name: "ReceivedMessages")
|
||||
receiver_user_Id String
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Class {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
ClassRoom Room[]
|
||||
students User[]
|
||||
Students User[]
|
||||
}
|
||||
|
||||
model Room {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
class Class[]
|
||||
Class Class[]
|
||||
Messages RoomMessage[]
|
||||
Documents RoomDocument[]
|
||||
Surveys RoomSurvey[]
|
||||
}
|
||||
|
||||
model RoomMessage {
|
||||
@ -58,6 +64,34 @@ model RoomDocument {
|
||||
roomId String
|
||||
}
|
||||
|
||||
model RoomSurvey {
|
||||
id Int @id @default(autoincrement())
|
||||
content String
|
||||
Room Room @relation(fields: [roomId], references: [id])
|
||||
roomId String
|
||||
createdAt DateTime @default(now())
|
||||
endAt DateTime?
|
||||
|
||||
Answers RoomSurveyAnswer[]
|
||||
}
|
||||
|
||||
model RoomSurveyAnswer {
|
||||
id Int @id @default(autoincrement())
|
||||
content String
|
||||
Survey RoomSurvey @relation(fields: [surveyId], references: [id])
|
||||
surveyId Int
|
||||
isRight Boolean
|
||||
Users RoomSurveyAnswerUser[]
|
||||
}
|
||||
|
||||
model RoomSurveyAnswerUser {
|
||||
id Int @id @default(autoincrement())
|
||||
User User @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
Answer RoomSurveyAnswer @relation(fields: [answerId], references: [id])
|
||||
answerId Int
|
||||
}
|
||||
|
||||
enum Role {
|
||||
STUDENT
|
||||
ADMIN
|
||||
|
Loading…
Reference in New Issue
Block a user