-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: convert MikroORM entities to DML entities #10043
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Skipped Deployments
|
|
@@ -20,12 +20,15 @@ export class ProductCategoryRepository extends DALUtils.MikroOrmBaseTreeReposito | |||
familyOptions: ProductCategoryTransformOptions = {} | |||
) { | |||
const findOptions_ = { ...findOptions } | |||
findOptions_.options ??= { | |||
orderBy: { rank: "ASC" }, | |||
findOptions_.options.orderBy = { |
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.
note: in the tests, the fields where provided and hence the options always populated, meaning that the order was never applied. By some random luck from god, the order remain the same for a long time, but the truth is that without any ordering we cant guarantee the order of the retrieved data. Now we always apply both rank and id, because rank only would also randomize all categories with the same rand and hence not enforce any ordering among each rank value. Now all categories are always ordered and the order remain constant.
further more, the rank was never selected, meaning that when we include ancerstors or descendant, the sortCategoriesByRank cant work since it is based on the property rank which was never deleted. I am really unsure how it worked so far except luck :)
cc @olivermrbl maybe you have an idea?
Maybe this will be clear from the code, but can you describe how we are inferring this now? |
sure, do you want it in the description or in a comment? nvm: I ve updated the description |
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.
Really nice work guys, love how simple the data model definitions are with the DML 💪
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.
Overall this LGTM, nice work
Can we add more descriptive guides for how you can avoid the breaking changes by setting the configurations explicitly? Would like to include these in the upgrade guide.
I ve added a mention and an example |
@olivermrbl lets wait for the pipeline but I believe we should be good now |
/snapshot-this |
🚀 A snapshot release has been made for this PRTest the snapshots by updating your yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add [email protected] yarn add @medusajs/[email protected] yarn add [email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected] yarn add @medusajs/[email protected]
|
Fixes FRMW-2790, FRMW-2777, FRMW-2798, FRMW-2800
DML Changelog
null
when the relationship is marked a nullable.isForeignKey: true
on the generate MikroORM property for thebelongsTo
relationship. However, the index in the database is still created. This is done to match the behaviour of relationships defined via MikroORM.manyToMany
relationship to inferowner
side of the relationship without relying on the order in which models are imported. Earlier, the first imported model was marked as theowner
. Could result in a breaking change especially in regards tojoinKey
andinverseJoinKey
columns. But the same can be fixed by explicitly defining these properties.inversedBy: true
on theowner
side of themanyToMany
relationship.manyToMany
pivot table name generation have been fixed. Meaning that it can be breaking changes in the scenario where nopivotTable
were provided. In order to fix the breaking change if needed, the user can provide thepivotTable
configuration with the existing name of the pivot table. (previously was using the models name in alpha order and pluralized last name, now it is using the table name from the model in alpha order with last one pluralized)joinerConfigBuilder
now merges the auto-generated primary keys with the one provided in the custom configuration if anyjoinerConfigBuilder
now merges the auto-generated linkable with the one infered from the custom linkable keys provided if anydeleted_at
where is null