1:1 관계 UserInfos UserInfos? // 1:1 관계
@id: 해당 필드가 기본 키 (Primary Key) 역할을 한다는 것을 나타냅니다.
model Users {
userId Int @id @default(autoincrement()) @map("userId")
email String @map("email")
password String @map("password")
createdAt DateTime @default(now()) @map("createdAt")
updatedAt DateTime @updatedAt @map("updatedAt")
UserInfos UserInfos? // 1:1 관계
@@map("Users")
}
model UserInfos {
userInfoId Int @id @default(autoincrement()) @map("userInfoId")
UserId Int @unique @map("UserId")
name String @map("name")
age Int? @map("age")
gender String @map("gender")
profileImage String? @map("profileImage)
createdAt DateTime @default(now()) @map("createdAt")
updatedAt DateTime @updatedAt @map("updatedAt")
User Users @relation(fields: [UserId], references: [userId], onDelete: Cascade)
@@map("UserInfos")
}
1:n 관계 Posts Posts[] // 1:n 관계