You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pivot tables are often used in relational databases to define one-to-many relationships.
In my case I'm using Adonis.js's Lucid ORM in my GraphQL resolvers, but things get a little tricky when loading relationships that use a pivot table. For example:
constuser=awaitcontext.loaders.userById.load(input.id);constposts=awaituser.posts().fetch();// Since I didn't use a loader to fetch posts, I now have to prime the cache manually:for(letpostofposts.rows){context.loaders.postById.prime(post.id,post);}
The downside to this is I lose the simplicity of only using my loaders to grab data, and I have to remember to manually priming my cache even when I might not need the data again.
The text was updated successfully, but these errors were encountered:
Pivot tables are often used in relational databases to define one-to-many relationships.
In my case I'm using Adonis.js's Lucid ORM in my GraphQL resolvers, but things get a little tricky when loading relationships that use a pivot table. For example:
The downside to this is I lose the simplicity of only using my loaders to grab data, and I have to remember to manually priming my cache even when I might not need the data again.
The text was updated successfully, but these errors were encountered: