v7 - Unsupported ID type

Unsupported ID type: PermissionsOnRoles on model Role in relation permissions
I have a many-to-many table called PermissionsOnRoles to join Role and Permission. prisma generate says like above. I don't get the details about what's going on. Is it because of the composite ID or? Before v7 is fine every time I generate Prisma client. Today I tried to update to newer version and this popping out. I still able to get the Prisma client successfully, but I'm afraid this will break the Docker build.
No description
2 Replies
Prisma AI Help
You chose to compile with the bot. One moment while I piece together your answer… 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])
}
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: - Double-check the Prisma release notes for v7 for any breaking changes regarding composite IDs or relation modeling. - If your Docker build depends on a successful prisma generate, you should be cautious and test thoroughly before upgrading. - If you need to stay compatible, consider pinning your Prisma version to the last known working release. If you need more details about v7-specific changes, the knowledge sources do not contain enough information to provide a definitive answer.
Nurul
Nurul2w ago
Was the bot response helpful?

Did you find this page helpful?