#Convex Ents 1:many rel

5 messages · Page 1 of 1 (latest)

dry peak
#

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:

events: defineEnt({[...]})
  .edge("organiser", { optional: true }),
organisers: defineEnt({[...]})
  .edges("events")

Getting no TS warnings in my IDE, but when saved I get this response from the CLI:

[1] Uncaught Error: Unexpected inverse edge type organiser, events
[2] at defineEntSchema (../../../node_modules/convex-ents/src/schema.ts:115:12)
[3] at <anonymous> (../convex/schema.ts:5:20)

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.

vapid plover
dry peak
#

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! 🙏

vapid plover
#

Yup, especially if you don't need cascading deletes then vanilla approach (which still works with Ents), is best.