Open kyldvs opened 7 months ago
The issue is that this way the inferred field names would have to be queriesId
, which goes against the typical convention of userId
or authorId
. But perhaps this is a fine tradeoff.
The current workaround is:
queries: defineEnt({})
.edges("foos", { ref: true }),
foos: defineEnt({})
.edge("query", { to: "queries", field: "queryId" })
I did call out this issue in the docs now:
Some people also argued that these naming inferences are bad altogether and we should always explicitly specify all the names in the config (which you are welcome to do).
I don't think it's very usable to make the table name change pluralization when adding an
edge()
vs adding anedges()
. It seems okay in simple cases:But starts to encourage weird names when you are using tables with non-standard pluralizations:
Since you already have
edge()
vsedges()
to distinguish 1 and many, I think it's better to always use the exact table name instead of using string manipulation to drop the "s" in theedge()
case: