prisma-client-rust icon indicating copy to clipboard operation
prisma-client-rust copied to clipboard

Unique constraints with composite type fields

Open darkyeg opened this issue 1 year ago • 3 comments

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()
    }
    ````

darkyeg avatar Mar 25 '24 21:03 darkyeg

TIL that's valid Prisma syntax. Could you make a reproduction of this? Would help with implementing it.

Brendonovich avatar Mar 28 '24 13:03 Brendonovich

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.

darkyeg avatar Mar 28 '24 22:03 darkyeg

@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

darkyeg avatar Mar 30 '24 13:03 darkyeg