PlayWolfYT
08/08/2022, 11:24 AMmodel User {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
phone String? @unique()
}
As you can see, the phone number is optional and unique. Yet when I register a user without a phone number, I cannot register a second user without a phone number, as I get the error "Unique constraint failed on the constraint: 'User_phone_key' ".
Any way to say that null
is not a phone number and that it should not get counted as a unique value?dpetrick
08/08/2022, 11:32 AMphone
and not use prisma migrate because that one creates a full unique index, not a partial one.PlayWolfYT
08/08/2022, 11:46 AM