Skip to content
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

Allow for including count of joined records #45

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Allow for including count of joined records #45

merged 1 commit into from
Feb 4, 2025

Conversation

leo
Copy link
Member

@leo leo commented Feb 4, 2025

The compiler currently already supports joining other records into the records that are being retrieved in the main query:

get.accounts.including(f => ({
  members: get.members.with.account(f.id)
}));

With the current change, it now also becomes possible to join the count of records instead of the records themselves:

get.accounts.including(f => ({
  memberAmount: count.members.with.account(f.id)
}));

The change was originally landed in ronin-co/compiler#131.


Furthermore:

On RONIN, link field constraints are designed to prevent the existence of children that don't have parents, and link field actions exist to automatically handle the children if something happens to the parents.

It therefore doesn't make sense to offer link field actions for many-cardinality relationships, since, in those cases, parents are referencing children, and parents should never be affected if something happens to the children, since there can be many children and only one parent.

Lastly, if the parents disappear, their references to the children should also disappear.

The change was originally landed in ronin-co/compiler#132.


Furthermore:

When altering models, it is not possible to pass any model entity (fields, indexes, triggers, or presets), as those must be altered individually. The change ensures that the types reflect this.

Furthermore, the idPrefix attribute can also only be provided when the model is created.

The change was originally landed in ronin-co/compiler#129.

@leo leo added the enhancement New feature or request label Feb 4, 2025
@leo leo requested review from NuroDev, juriadams and colodenn February 4, 2025 09:29
Copy link

github-actions bot commented Feb 4, 2025

Released an experimental package:

bun add ronin@leo-ron-1099-2-experimental-60

This package will be removed after the pull request has been merged.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

@leo leo marked this pull request as ready for review February 4, 2025 09:30
@leo leo enabled auto-merge (squash) February 4, 2025 09:30
@leo leo merged commit d3eeb34 into main Feb 4, 2025
5 checks passed
@leo leo deleted the leo/ron-1099-2 branch February 4, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants