Problem
It would be useful if Instant schema could express that a relation is required, so application data can rely on that invariant being enforced by the database layer.
Today, even when an app models a one-to-one or one-to-many link as conceptually mandatory, the relation can still be unset. That means applications need to enforce the invariant entirely in application code and periodically audit or repair missing links.
Feature request
Add support for required relation constraints in the schema.
Examples of the kind of guarantees that would be helpful:
- a one-link that must always be present
- a relation with a minimum cardinality, such as at least one linked record
- validation on writes so invalid states are rejected instead of silently accepted
Why this would help
This would make schema definitions more expressive and reduce a class of data-integrity bugs that are otherwise easy to introduce through alternate write paths, migrations, or manual/admin mutations.
Possible directions
Some possible designs:
- schema-level
required support for links
min / max cardinality constraints on relations
- optional validation tooling that can both block invalid writes and report existing violations
Even a limited first version for required one-links would be very useful.
Problem
It would be useful if Instant schema could express that a relation is required, so application data can rely on that invariant being enforced by the database layer.
Today, even when an app models a one-to-one or one-to-many link as conceptually mandatory, the relation can still be unset. That means applications need to enforce the invariant entirely in application code and periodically audit or repair missing links.
Feature request
Add support for required relation constraints in the schema.
Examples of the kind of guarantees that would be helpful:
Why this would help
This would make schema definitions more expressive and reduce a class of data-integrity bugs that are otherwise easy to introduce through alternate write paths, migrations, or manual/admin mutations.
Possible directions
Some possible designs:
requiredsupport for linksmin/maxcardinality constraints on relationsEven a limited first version for required one-links would be very useful.