The error message "Unsupported ID type: PermissionsOnRoles on model Role in relation permissions" after upgrading to Prisma v7 is likely related to your use of a composite (compound) ID on the PermissionsOnRoles join table for your many-to-many relationship.
From the knowledge sources, Prisma supports explicit many-to-many relations with a join table that uses a compound ID (e.g., @@id([permissionId, roleId])). This pattern works in versions before v7, as shown in the following schema:
model Role {
id Int @id @default(autoincrement())
name String @unique
description String
permissions PermissionsOnRoles[]
}
model Permission {
id Int @id @default(autoincrement())
name String @unique
description String
roles PermissionsOnRoles[]
}
model PermissionsOnRoles {
permission Permission @relation(fields: [permissionId], references: [id])
permissionId Int
role Role @relation(fields: [roleId], references: [id])
roleId Int
description1 String
description2 String
@@id([permissionId, roleId])
}
This is a valid and supported approach in Prisma up to at least v5 and v6, and is referenced in the docs and issues as the correct way to model explicit m-n relations with composite IDs One-to-many relations, How to use a relation table with a many-to-many relationship.
However, your error suggests that Prisma v7 may have introduced a breaking change or a stricter validation regarding ID types in relations, especially with composite IDs. The knowledge sources do not provide explicit details about v7 changes, but based on your experience and the error, it is likely related to the composite ID on the join table.
Recommendation: