MySQL Prisma schema has an inconsistent Account relation
Author: KariMuhammadCreated Jul 25, 2026Updated Jul 25, 2026
Labelstriage
The MySQL schema in the Prisma adapter documentation defines an inconsistent relationship between User and Account:
model User {
accounts Account[]
}
model Account {
userId String @unique
user User? @relation(fields: [userId], references: [id])
}There are two issues:
userIdis required, but the correspondinguserrelation is marked as optional.userId @uniqueprevents multiple accounts from referencing the same user. This conflicts withaccounts Account[]and prevents users from linking multiple providers.
The relationship should instead be:
model User {
accounts Account[]
}
model Account {
userId String
user User @relation(fields: [userId], references: [id])
} The existing @@unique([provider, providerAccountId]) constraint should remain because it uniquely identifies each provider account.
Is there any context that might help us understand?
The PostgreSQL, SQLite, and MongoDB examples use a required, non-unique userId and a required User relation.
Aligning the MySQL example with them accurately models the intended one-to-many relationship: every account belongs to one user, while one user may link multiple provider accounts, such as GitHub and Google.
Does the docs page already exist? Please link to it.
Source: nextauthjs/next-auth