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
I need many to many relations in PostGraphile, and found this plugin but multi column key relations are not generated. I see // TODO: handle multi-column comment.
pg-structure (I'm developer of it) library provides the functions you need.
Below is a sample code for this use case:
constpgStructure=require("pg-structure").default;asyncfunctiondemo(){constdb=awaitpgStructure({database: "teknik",user: "user",password: "password"},{includeSchemas: ["public","Region"]});constaccountTable=db.get("public.Account");// TypeScript: db.get("public.Account") as Entityconsole.log(accountTable.belongsToManyTables.map(t=>t.name))console.log(accountTable.m2mRelations.map(r=>r.name))}demo();
You can access all many to many tables including multi column keys using belongsToManyTables and m2mRelations. I suggest to use m2mRelations object, which provides more info and possibilities. You can use your inflection methods easily.
I would be happy to if you have questions or need assistance how to use.
The text was updated successfully, but these errors were encountered:
Hi,
I need many to many relations in PostGraphile, and found this plugin but multi column key relations are not generated. I see
// TODO: handle multi-column
comment.pg-structure (I'm developer of it) library provides the functions you need.
Below is a sample code for this use case:
You can access all many to many tables including multi column keys using
belongsToManyTables
andm2mRelations
. I suggest to use m2mRelations object, which provides more info and possibilities. You can use your inflection methods easily.I would be happy to if you have questions or need assistance how to use.
The text was updated successfully, but these errors were encountered: