Convex Ents 1:many rel
Hey!
I'm playing around a bit with Convex Ents and I'm running into an issue which I don't know if it's due to my lack of understanding how edges works.
I've got two tables with a 1:many relationships,
organisers
can have many events
or none, and events
can have one organiser
or none. So my idea was this:
Getting no TS warnings in my IDE, but when saved I get this response from the CLI:
Am I doing something wrong or is it simply impossible for the singular edge to be optional? I noticed the docs say that optional 1:1 are not supported but I figured this is a 1:many so it might not apply.3 Replies
You got it right, optional 1:many edges are not supported yet:
https://github.com/xixixao/convex-ents/issues/5
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.
All right! Then I guess if I wanna stick to Ents the second best option is to create a many:many relationship? Otherwise it's always possible to do it in vanilla Convex, right?
Also thanks for the quick reply! ๐
Yup, especially if you don't need cascading deletes then vanilla approach (which still works with Ents), is best.
So
v.optional(v.id("otherTable"))