Skip to content

proposal: a roll-up whose counted child is owned by another model - #56

Merged
delchev merged 1 commit into
mainfrom
propose/cross-model-rollup-child
Aug 24, 2026
Merged

proposal: a roll-up whose counted child is owned by another model#56
delchev merged 1 commit into
mainfrom
propose/cross-model-rollup-child

Conversation

@delchev

@delchev delchev commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Proposal 0028-cross-model-rollup-child.md.

A rollups: entry requires the counted child to be declared in the same model as the parent whose field it maintains. That makes a natural total inexpressible whenever an n:m pairing puts the link rows in another module - the link entity lives with the document that owns one side of the pairing, while the other side's total belongs to the module that owns it.

The accounts-receivable shape: the invoice-side total over the allocation rows is expressible today (the allocation entity belongs to the invoicing model); the payment-side total over the same rows is not, so "is this payment fully applied?" and "how much credit is on account?" are answered by a report instead of by a stored, filterable number.

Adds model: (the owner's uses: alias - as a cross-model schedule source already takes) plus parent: (the local entity the total lands on; authored rather than derived, because a foreign child's relations are not in the document for via to be walked through), and states the edge rules: the parent must be local, the foreign via / of / by are validated against the owner's generated model and a via referencing another entity is refused, the capacity guard cannot follow across the boundary while the balance and status can, which side of a re-parent is repaired, and that a restricted foreign field does not propagate its restriction.

Reference implementation: eclipse-dirigible/dirigible#6932 (issue eclipse-dirigible/dirigible#6930).

A `rollups:` entry requires the counted child to be declared in the same model
as the parent whose field it maintains, which makes a natural total
inexpressible whenever an n:m pairing puts the link rows in another module: the
link entity lives with the document that owns one side of the pairing, while the
other side's total belongs to the module that owns it.

The proposal adds `model:` (the owner's `uses:` alias, as a cross-model schedule
source already takes) plus `parent:` (the local entity the total lands on -
authored, because a foreign child's relations are not in the document for `via`
to be walked through), and states the edge rules: the parent must be local, the
foreign properties are validated against the owner's model, the capacity guard
cannot follow across the boundary, and which side of a re-parent is repaired.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant