Optional one to many relationship (convex-ents)
Hello,
Is there a way to make an optional one to many relationship using egdes ?
I would like to affect users to a group or no group.
`
6 Replies
Not at the moment, but you're not the first to ask! Tracking issue: https://github.com/xixixao/convex-ents/issues/5
You can model this atm without Ents (via an ID field) or as a many:many edge.
GitHub
1:many edges require single cardinality end to be required · Issue ...
This will require more configuration, especially for cascading deletes. We'll hold off on adding this until we get people asking for it.
@Michal Srb ok, if I model it without ents, i presume that I won't be able to use the edge methods on this relationship too right ?
you answered so fast thank you
I'd probably go with many:many, it will give you the flexibility to later change your design to allow users to be attached to multiple groups.
Ok thanks for the advice
Hello @Michal Srb any idea on how to replace search since I can't use withSearchIndex with ctx.table ? I mean in convex way. For now I will implement it myself
It's so funny i was just researching this stuff just now. The saas-starter has a .searchIndex. Its being used on members.ts like this.
I'm trying to use the complex index and search filtering in the fullstack convex template as guidance and with similar complexity so I'm struggling through trying to do it in ents.
@ampp ohhh wow I didn't know about that, let me take a look