I’m attempting to create an instagram clone where I can follow people, post images, comment on those posts etc. Here is my schema.
model User {
id Int @id @default(autoincrement())
username String @unique
email String @unique
password String
profile Profile
posts Post[]
comments Comment[]
}
model Post {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
imageUrl String
comments Comment[]
}
model Comment {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
post Post @relation(fields: [postId], references: [id])
postId Int
text String
}
model Profile {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
firstName String
lastName String
website String
bio String
privateAccount Boolean @default(false)
showActivityStatus Boolean @default(true)
}