amplication / amplication

🔥🔥🔥 The Only Production-Ready AI-Powered Backend Code Generation
https://amplication.com
Other
15.13k stars 1.48k forks source link

🐛 Bug Report: 1:1 relation must use unique field on the defining side - has `@unique` attribute #6470

Open abrl91 opened 1 year ago

abrl91 commented 1 year ago

What happened?

When setting a 1:1 relation, in the generated Prisma schema the @unique attribute is not added and not generated.

What you expected to happen

I expect to see in the UI the unique toggle on and in the generated Prisma schema the @unique attribute on the field represents the fk hoder on the relation

How to reproduce

Amplication version

1.7.7

Environment

No response

Are you willing to submit PR?

No response

GreenMachine01 commented 1 year ago

After discussion, we want to perform the fix only on the DSG side so it will enforce the uniqueness without the need to do any guards/changes in the client.