-
-
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
feature: add support for check constraints in DML #10391
Conversation
🦋 Changeset detectedLatest commit: b45c48e The changes in this PR will be included in the next version bump. This PR includes changesets to release 65 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 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
Fixes: FRMW-2818
The
.checks
method on the DML could be used to define the PostgreSQL constraints. In the following example, we configure a constraint that validates theamount
column on theShippingMethod
model to have a value of>=0
.The
.checks
method accepts an array of callbacks or objects. The object signature must match have the properties accepted by the MikroORM's@Check
decorator. https://mikro-orm.io/docs/5.9/defining-entities#check-constraintsChecks will result in the following migration statement.