I have a user model, and i want to add following/followers system, and for that i think i need to create a separate table that looks like this
id | user_id | follower_id
1 | 20 | 45
2 | 20 | 53
3 | 32 | 20
but i have no idea how to create the schema for that, what I've done is this:
model User {
id Int @id @default(autoincrement())
username String
Follows Follows[]
}
model Follows {
id Int @id @default(autoincrement())
following_id Int?
follower_id Int?
user_Following User @relation(fields: [following_id], references: [id])
user_Follower User @relation(fields: [follower_id], references: [id])
}
but that of course doesn't work and is giving me an error