Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique constraints with composite type fields #448

Open
darkyeg opened this issue Mar 25, 2024 · 3 comments
Open

Unique constraints with composite type fields #448

darkyeg opened this issue Mar 25, 2024 · 3 comments

Comments

@darkyeg
Copy link

darkyeg commented Mar 25, 2024

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()
    }
    ````
@Brendonovich
Copy link
Owner

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

@Brendonovich Brendonovich changed the title There is a problem when creating a unique constraint by composite type Unique constraints with composite type fields Mar 28, 2024
@darkyeg
Copy link
Author

darkyeg commented Mar 28, 2024

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
Copy link
Author

darkyeg commented Mar 30, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants