Replies: 2 comments
|
Hello @ricklrq 👋 This constraint of defining a unique field when using one-to-one relations was introduced in Prisma v4.0.0 as described here. Prisma does not automatically determine the uniqueness of fields in the relational database. It relies on the definition of the fields in the relational database as well as any constraints or indexes that have been applied to those fields. |
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that haven’t had any recent activity and appear to be outdated. If this discussion is still important to you or unresolved, we’d love to hear from you! Feel free to reopen it or start a new one with updated details. For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and being part of the community! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have (simplified) table design in SQL Server as follows:
I know it might not be a good design, but it is valid and serves the purpose for my work.
Basically [DentalService].[DentalService] table is like a sub/child/extension table of [Referral].[Referral], though you can say that I should combine the two tables. But dental service is like its own entities. That's why it has its own schema and sets of tables. We have lots of referred services like detox service, car rental service, etc. similar to dental service and all tied to [Referral].[Referral] table.
I tried to generate a Prisma schema from my existing database and it works fine. But then when I tried to run
npx prisma generateI go the following error:
Can someone explain why I need to add a unique constraint [CustomerId, DentalServiceId] on [DentalService].[DentalService] table? From a database table relationship point of view, I don't think we need to.
Here is the shema.prisma generated:
All reactions