7 year old Timmy
7 year old Timmy
PPrisma
Created by 7 year old Timmy on 12/17/2024 in #help-and-questions
Prisma Schema Pull/Push Issues
Hi! Managed to fix the issue by changing the schema. Had to change this
model UserGroups {
A String
B String
Group Group @relation(fields: [A], references: [id], onDelete: Cascade)
User User @relation(fields: [B], references: [id], onDelete: Cascade)

@@id([A, B], map: "_UserGroups_AB_pkey")
@@index([B], map: "_UserGroups_B_index")
@@map("_UserGroups")
}
model UserGroups {
A String
B String
Group Group @relation(fields: [A], references: [id], onDelete: Cascade)
User User @relation(fields: [B], references: [id], onDelete: Cascade)

@@id([A, B], map: "_UserGroups_AB_pkey")
@@index([B], map: "_UserGroups_B_index")
@@map("_UserGroups")
}
to
model UserGroups {
groupId String
userId String
group Group @relation(fields: [groupId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@id([groupId, userId])
@@index([userId])
@@schema("public")
}
model UserGroups {
groupId String
userId String
group Group @relation(fields: [groupId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@id([groupId, userId])
@@index([userId])
@@schema("public")
}
apparently was because of the _ ? not too sure but it pulls fine on a different codebase. Not too sure what really caused the issue but my workaround was that
4 replies