Unique constraints with composite type fields
user and phone model
model User {
phone PhoneNumber?
@@unique(name: "unqiue_phone", [phone.countryCode, phone.number])
}
type PhoneNumber {
countryCode String
number String
}
the generated
pub fn phone_phone<T: From<UniqueWhereParam>>(
phone: crate::prisma::phone_number::Data,
phone: crate::prisma::phone_number::Data,
) -> T {
UniqueWhereParam::PhonePhoneEquals(phone, phone).into()
}
````
TIL that's valid Prisma syntax. Could you make a reproduction of this? Would help with implementing it.
TIL that's valid Prisma syntax. Could you make a reproduction of this? Would help with implementing it.
No problems, there are other problems related to composite type, I will try to add them all in a repository.
@Brendonovich I have gathered all the issues encountered with composite types in one repository. If I encounter any other issues, I will add them to the same location and inform you. Each problem has been placed in a separate branch. https://github.com/darkyeg/prisma-rust-composite-problems