-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat: add support for defining hasOne with FK #10441
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, lets move with this and see how it goes during the rest of the migration
@olivermrbl and @shahednasser. We do not want to document this right now, as we might see some breaking changes coming to |
Fixes: FRMW-2825
In this PR we add support for defining
hasOne
relationship in DML with support for foreign keys. This is added because of the way relationships are defined within our Medusa modules and many of them needs ahasOne with Cascades
andFK
on the same side.A good example of this is
Cart
andAddress
. The relationship is defined asCart hasOne Address
and theCart
model has theaddress_id
. Also, we want a new address to be created automatically viacascades: ['persist']
setting when defined on a Cart.